Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
CentroidDetection.h
1 #pragma once
2 #include <stdint.h>
3 #include <vector>
4 #include <memory>
5 
7 {
8 public:
9  typedef float DATA_T;
10  CentroidDetection() {};
11  CentroidDetection(unsigned int numReadings, unsigned int maxNumCentroids, float sizeScale);
12  CentroidDetection(const std::vector<unsigned int>& order, unsigned int maxNumCentroids, float sizeScale);
13  int setup(unsigned int numReadings, unsigned int maxNumCentroids, float sizeScale);
14  int setup(const std::vector<unsigned int>& order, unsigned int maxNumCentroids, float sizeScale);
15  void process(const DATA_T* rawData);
16  void setSizeScale(float sizeScale);
17  void setMinimumTouchSize(DATA_T minSize);
18  unsigned int getNumTouches();
19  DATA_T touchLocation(unsigned int touch_num);
20  DATA_T touchSize(unsigned int touch_num);
21  DATA_T compoundTouchLocation();
22  DATA_T compoundTouchSize();
23 private:
24  typedef uint16_t WORD;
25  class CalculateCentroids;
26  std::vector<DATA_T> centroids;
27  std::vector<DATA_T> sizes;
28  std::vector<WORD> centroidBuffer;
29  std::vector<WORD> sizeBuffer;
30  unsigned int maxNumCentroids;
31  std::vector<unsigned int> order;
32  std::vector<WORD> data;
33  float sizeScale;
34  float locationScale;
35  std::shared_ptr<CalculateCentroids> cc;
36  unsigned int num_touches;
37 };
Definition: CentroidDetection.cpp:5
Definition: CentroidDetection.h:6