1 | /*! |
---|
2 | * \file OpticalFlowData.h |
---|
3 | * \brief Class defining pptical flow datas |
---|
4 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 |
---|
5 | * \date 2012/04/12 |
---|
6 | * \version 4.0 |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef OPTICALFLOWDATA_H |
---|
10 | #define OPTICALFLOWDATA_H |
---|
11 | |
---|
12 | #include <cxcore.h> |
---|
13 | #include <io_data.h> |
---|
14 | |
---|
15 | namespace flair { namespace filter { |
---|
16 | /*! \class OpticalFlowData |
---|
17 | * |
---|
18 | * \brief Class defining optical flow datas |
---|
19 | * |
---|
20 | * Optical flow datas are composed of the following: \n |
---|
21 | * PointsA: tracked points on first image |
---|
22 | * PointsB: tracked points on second image |
---|
23 | * FoundFeature: array representing if a point on first image is found on second image |
---|
24 | * FeatureError: array representing correlation error for each point (confidence) |
---|
25 | */ |
---|
26 | class OpticalFlowData: public core::io_data { |
---|
27 | public: |
---|
28 | class Type: public core::DataType { |
---|
29 | size_t GetSize() const {return 0;} //TODO |
---|
30 | std::string GetDescription() const {return "optical flow";} |
---|
31 | }; |
---|
32 | |
---|
33 | /*! |
---|
34 | * \brief Constructor |
---|
35 | * |
---|
36 | * Construct OpticalFlowData. |
---|
37 | * |
---|
38 | * \param parent parent |
---|
39 | * \param max_features maximum number of features to track |
---|
40 | * \param name name |
---|
41 | * \param n number of samples for the io_data |
---|
42 | */ |
---|
43 | OpticalFlowData(const core::Object* parent,uint32_t max_features,std::string name="",uint32_t n=1); |
---|
44 | |
---|
45 | /*! |
---|
46 | * \brief Destructor |
---|
47 | * |
---|
48 | */ |
---|
49 | ~OpticalFlowData(); |
---|
50 | |
---|
51 | /*! |
---|
52 | * \brief Points on first image |
---|
53 | * |
---|
54 | */ |
---|
55 | CvPoint* PointsA(void) const; |
---|
56 | |
---|
57 | /*! |
---|
58 | * \brief Points on second image |
---|
59 | * |
---|
60 | */ |
---|
61 | CvPoint2D32f* PointsB(void) const; |
---|
62 | |
---|
63 | /*! |
---|
64 | * \brief Features found |
---|
65 | * |
---|
66 | * value of the array is one if feature is found |
---|
67 | */ |
---|
68 | char *FoundFeature(void) const; |
---|
69 | |
---|
70 | /*! |
---|
71 | * \brief Correlation error |
---|
72 | * |
---|
73 | */ |
---|
74 | uint32_t *FeatureError(void) const; |
---|
75 | |
---|
76 | /*! |
---|
77 | * \brief Set points of interest of frst image |
---|
78 | * |
---|
79 | * \param points points |
---|
80 | */ |
---|
81 | void SetPointsA(const CvPoint *points); |
---|
82 | |
---|
83 | /*! |
---|
84 | * \brief Set points of interest of second image |
---|
85 | * |
---|
86 | * \param points points |
---|
87 | */ |
---|
88 | void SetPointsB(const CvPoint2D32f *points); |
---|
89 | |
---|
90 | /*! |
---|
91 | * \brief Set found features |
---|
92 | * |
---|
93 | * \param found_features found features |
---|
94 | */ |
---|
95 | void SetFoundFeature(const char *found_features); |
---|
96 | |
---|
97 | /*! |
---|
98 | * \brief Set features error |
---|
99 | * |
---|
100 | * \param features_error features error |
---|
101 | */ |
---|
102 | void SetFeatureError(const unsigned int *features_error); |
---|
103 | |
---|
104 | /*! |
---|
105 | * \brief Number of maximum features |
---|
106 | * |
---|
107 | */ |
---|
108 | uint32_t MaxFeatures(void) const; |
---|
109 | |
---|
110 | /*! |
---|
111 | * \brief Number of tracked features |
---|
112 | * |
---|
113 | */ |
---|
114 | uint32_t NbFeatures(void) const; |
---|
115 | |
---|
116 | /*! |
---|
117 | * \brief Set number of tracked features |
---|
118 | * |
---|
119 | * \param value number of tracked features |
---|
120 | */ |
---|
121 | void SetNbFeatures(uint32_t value); |
---|
122 | |
---|
123 | /*! |
---|
124 | * \brief Change number of maximum features |
---|
125 | * |
---|
126 | * \param value new number of maximum tracked features |
---|
127 | */ |
---|
128 | void Resize(uint32_t value); |
---|
129 | |
---|
130 | OpticalFlowData::Type const &GetDataType() const {return dataType;} |
---|
131 | |
---|
132 | /*! |
---|
133 | * \brief Raw read datas |
---|
134 | * |
---|
135 | * Reimplemented from io_data. \n |
---|
136 | * See io_data::RawRead. |
---|
137 | * |
---|
138 | * \param dst destination buffer |
---|
139 | */ |
---|
140 | void RawRead(char *dst) const; |
---|
141 | |
---|
142 | private: |
---|
143 | uint32_t max_features; |
---|
144 | uint32_t nb_features; |
---|
145 | CvPoint* pointsA; |
---|
146 | CvPoint2D32f* pointsB; |
---|
147 | char *found_features; |
---|
148 | uint32_t *features_error; |
---|
149 | Type dataType; |
---|
150 | }; |
---|
151 | } // end namespace filter |
---|
152 | } // end namespace flair |
---|
153 | #endif // OPTICALFLOWDATA_H |
---|