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