tracking.hpp
Go to the documentation of this file.
1 
5 /*M///////////////////////////////////////////////////////////////////////////////////////
6 //
7 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
8 //
9 // By downloading, copying, installing or using the software you agree to this license.
10 // If you do not agree to this license, do not download, install,
11 // copy or use the software.
12 //
13 //
14 // License Agreement
15 // For Open Source Computer Vision Library
16 //
17 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
18 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
19 // Third party copyrights are property of their respective owners.
20 //
21 // Redistribution and use in source and binary forms, with or without modification,
22 // are permitted provided that the following conditions are met:
23 //
24 // * Redistribution's of source code must retain the above copyright notice,
25 // this list of conditions and the following disclaimer.
26 //
27 // * Redistribution's in binary form must reproduce the above copyright notice,
28 // this list of conditions and the following disclaimer in the documentation
29 // and/or other materials provided with the distribution.
30 //
31 // * The name of the copyright holders may not be used to endorse or promote products
32 // derived from this software without specific prior written permission.
33 //
34 // This software is provided by the copyright holders and contributors "as is" and
35 // any express or implied warranties, including, but not limited to, the implied
36 // warranties of merchantability and fitness for a particular purpose are disclaimed.
37 // In no event shall the Intel Corporation or contributors be liable for any direct,
38 // indirect, incidental, special, exemplary, or consequential damages
39 // (including, but not limited to, procurement of substitute goods or services;
40 // loss of use, data, or profits; or business interruption) however caused
41 // and on any theory of liability, whether in contract, strict liability,
42 // or tort (including negligence or otherwise) arising in any way out of
43 // the use of this software, even if advised of the possibility of such damage.
44 //
45 //M*/
46 
47 #ifndef __OPENCV_TRACKING_HPP__
48 #define __OPENCV_TRACKING_HPP__
49 
50 #include "opencv2/core/core.hpp"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /****************************************************************************************\
58 * Motion Analysis *
59 \****************************************************************************************/
60 
61 /************************************ optical flow ***************************************/
62 
63 #define CV_LKFLOW_PYR_A_READY 1
64 #define CV_LKFLOW_PYR_B_READY 2
65 #define CV_LKFLOW_INITIAL_GUESSES 4
66 #define CV_LKFLOW_GET_MIN_EIGENVALS 8
67 
68 /* It is Lucas & Kanade method, modified to use pyramids.
69  Also it does several iterations to get optical flow for
70  every point at every pyramid level.
71  Calculates optical flow between two images for certain set of points (i.e.
72  it is a "sparse" optical flow, which is opposite to the previous 3 methods) */
73 CVAPI(void) cvCalcOpticalFlowPyrLK( const CvArr* prev, const CvArr* curr,
77  int count,
79  int level,
80  char* status,
81  float* track_error,
83  int flags );
84 
85 
86 /* Modification of a previous sparse optical flow algorithm to calculate
87  affine flow */
88 CVAPI(void) cvCalcAffineFlowPyrLK( const CvArr* prev, const CvArr* curr,
89  CvArr* prev_pyr, CvArr* curr_pyr,
90  const CvPoint2D32f* prev_features,
91  CvPoint2D32f* curr_features,
92  float* matrices, int count,
93  CvSize win_size, int level,
94  char* status, float* track_error,
95  CvTermCriteria criteria, int flags );
96 
97 /* Estimate rigid transformation between 2 images or 2 point sets */
98 CVAPI(int) cvEstimateRigidTransform( const CvArr* A, const CvArr* B,
99  CvMat* M, int full_affine );
100 
101 /* Estimate optical flow for each pixel using the two-frame G. Farneback algorithm */
102 CVAPI(void) cvCalcOpticalFlowFarneback( const CvArr* prev, const CvArr* next,
103  CvArr* flow, double pyr_scale, int levels,
104  int winsize, int iterations, int poly_n,
105  double poly_sigma, int flags );
106 
107 /********************************* motion templates *************************************/
108 
109 /****************************************************************************************\
110 * All the motion template functions work only with single channel images. *
111 * Silhouette image must have depth IPL_DEPTH_8U or IPL_DEPTH_8S *
112 * Motion history image must have depth IPL_DEPTH_32F, *
113 * Gradient mask - IPL_DEPTH_8U or IPL_DEPTH_8S, *
114 * Motion orientation image - IPL_DEPTH_32F *
115 * Segmentation mask - IPL_DEPTH_32F *
116 * All the angles are in degrees, all the times are in milliseconds *
117 \****************************************************************************************/
118 
119 /* Updates motion history image given motion silhouette */
120 CVAPI(void) cvUpdateMotionHistory( const CvArr* silhouette, CvArr* mhi,
121  double timestamp, double duration );
122 
123 /* Calculates gradient of the motion history image and fills
124  a mask indicating where the gradient is valid */
125 CVAPI(void) cvCalcMotionGradient( const CvArr* mhi, CvArr* mask, CvArr* orientation,
126  double delta1, double delta2,
127  int aperture_size CV_DEFAULT(3));
128 
129 /* Calculates average motion direction within a selected motion region
130  (region can be selected by setting ROIs and/or by composing a valid gradient mask
131  with the region mask) */
132 CVAPI(double) cvCalcGlobalOrientation( const CvArr* orientation, const CvArr* mask,
133  const CvArr* mhi, double timestamp,
134  double duration );
135 
136 /* Splits a motion history image into a few parts corresponding to separate independent motions
137  (e.g. left hand, right hand) */
138 CVAPI(CvSeq*) cvSegmentMotion( const CvArr* mhi, CvArr* seg_mask,
140  double timestamp, double seg_thresh );
141 
142 /****************************************************************************************\
143 * Tracking *
144 \****************************************************************************************/
145 
146 /* Implements CAMSHIFT algorithm - determines object position, size and orientation
147  from the object histogram back project (extension of meanshift) */
148 CVAPI(int) cvCamShift( const CvArr* prob_image, CvRect window,
150  CvBox2D* box CV_DEFAULT(NULL) );
151 
152 /* Implements MeanShift algorithm - determines object position
153  from the object histogram back project */
154 CVAPI(int) cvMeanShift( const CvArr* prob_image, CvRect window,
155  CvTermCriteria criteria, CvConnectedComp* comp );
156 
157 /*
158 standard Kalman filter (in G. Welch' and G. Bishop's notation):
159 
160  x(k)=A*x(k-1)+B*u(k)+w(k) p(w)~N(0,Q)
161  z(k)=H*x(k)+v(k), p(v)~N(0,R)
162 */
163 typedef struct CvKalman
164 {
165  int MP; /* number of measurement vector dimensions */
166  int DP; /* number of state vector dimensions */
167  int CP; /* number of control vector dimensions */
168 
169  /* backward compatibility fields */
170 #if 1
171  float* PosterState; /* =state_pre->data.fl */
172  float* PriorState; /* =state_post->data.fl */
173  float* DynamMatr; /* =transition_matrix->data.fl */
174  float* MeasurementMatr; /* =measurement_matrix->data.fl */
175  float* MNCovariance; /* =measurement_noise_cov->data.fl */
176  float* PNCovariance; /* =process_noise_cov->data.fl */
177  float* KalmGainMatr; /* =gain->data.fl */
178  float* PriorErrorCovariance;/* =error_cov_pre->data.fl */
179  float* PosterErrorCovariance;/* =error_cov_post->data.fl */
180  float* Temp1; /* temp1->data.fl */
181  float* Temp2; /* temp2->data.fl */
182 #endif
183 
184  CvMat* state_pre; /* predicted state (x'(k)):
185  x(k)=A*x(k-1)+B*u(k) */
186  CvMat* state_post; /* corrected state (x(k)):
187  x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) */
188  CvMat* transition_matrix; /* state transition matrix (A) */
189  CvMat* control_matrix; /* control matrix (B)
190  (it is not used if there is no control)*/
191  CvMat* measurement_matrix; /* measurement matrix (H) */
192  CvMat* process_noise_cov; /* process noise covariance matrix (Q) */
193  CvMat* measurement_noise_cov; /* measurement noise covariance matrix (R) */
194  CvMat* error_cov_pre; /* priori error estimate covariance matrix (P'(k)):
195  P'(k)=A*P(k-1)*At + Q)*/
196  CvMat* gain; /* Kalman gain matrix (K(k)):
197  K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)*/
198  CvMat* error_cov_post; /* posteriori error estimate covariance matrix (P(k)):
199  P(k)=(I-K(k)*H)*P'(k) */
200  CvMat* temp1; /* temporary matrices */
205 } CvKalman;
206 
207 /* Creates Kalman filter and sets A, B, Q, R and state to some initial values */
208 CVAPI(CvKalman*) cvCreateKalman( int dynam_params, int measure_params,
209  int control_params CV_DEFAULT(0));
210 
211 /* Releases Kalman filter state */
212 CVAPI(void) cvReleaseKalman( CvKalman** kalman);
213 
214 /* Updates Kalman filter by time (predicts future state of the system) */
215 CVAPI(const CvMat*) cvKalmanPredict( CvKalman* kalman,
216  const CvMat* control CV_DEFAULT(NULL));
217 
218 /* Updates Kalman filter by measurement
219  (corrects state of the system and internal matrices) */
220 CVAPI(const CvMat*) cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement );
221 
222 #define cvKalmanUpdateByTime cvKalmanPredict
223 #define cvKalmanUpdateByMeasurement cvKalmanCorrect
224 
225 #ifdef __cplusplus
226 }
227 
228 namespace cv
229 {
230 
232 CV_EXPORTS_W void updateMotionHistory( InputArray silhouette, InputOutputArray mhi,
233  double timestamp, double duration );
234 
236 CV_EXPORTS_W void calcMotionGradient( InputArray mhi, OutputArray mask,
238  double delta1, double delta2,
239  int apertureSize=3 );
240 
242 CV_EXPORTS_W double calcGlobalOrientation( InputArray orientation, InputArray mask,
243  InputArray mhi, double timestamp,
244  double duration );
245 
246 CV_EXPORTS_W void segmentMotion(InputArray mhi, OutputArray segmask,
247  CV_OUT vector<Rect>& boundingRects,
248  double timestamp, double segThresh);
249 
251 CV_EXPORTS_W RotatedRect CamShift( InputArray probImage, CV_OUT CV_IN_OUT Rect& window,
252  TermCriteria criteria );
253 
255 CV_EXPORTS_W int meanShift( InputArray probImage, CV_OUT CV_IN_OUT Rect& window,
256  TermCriteria criteria );
257 
265 class CV_EXPORTS_W KalmanFilter
266 {
267 public:
269  CV_WRAP KalmanFilter();
271  CV_WRAP KalmanFilter(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F);
273  void init(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F);
274 
276  CV_WRAP const Mat& predict(const Mat& control=Mat());
278  CV_WRAP const Mat& correct(const Mat& measurement);
279 
290 
291  // temporary matrices
297 };
298 
299 enum
300 {
301  OPTFLOW_USE_INITIAL_FLOW = CV_LKFLOW_INITIAL_GUESSES,
302  OPTFLOW_LK_GET_MIN_EIGENVALS = CV_LKFLOW_GET_MIN_EIGENVALS,
304 };
305 
308  Size winSize, int maxLevel, bool withDerivatives = true,
309  int pyrBorder = BORDER_REFLECT_101, int derivBorder = BORDER_CONSTANT,
310  bool tryReuseInputImage = true);
311 
313 CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg,
314  InputArray prevPts, CV_OUT InputOutputArray nextPts,
316  Size winSize=Size(21,21), int maxLevel=3,
317  TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01),
318  int flags=0, double minEigThreshold=1e-4);
319 
321 CV_EXPORTS_W void calcOpticalFlowFarneback( InputArray prev, InputArray next,
322  CV_OUT InputOutputArray flow, double pyr_scale, int levels, int winsize,
323  int iterations, int poly_n, double poly_sigma, int flags );
324 
326 // that maps one 2D point set to another or one image to another.
328  bool fullAffine);
329 
331 CV_EXPORTS_W void calcOpticalFlowSF(Mat& from,
332  Mat& to,
333  Mat& flow,
334  int layers,
335  int averaging_block_size,
336  int max_flow);
337 
338 CV_EXPORTS_W void calcOpticalFlowSF(Mat& from,
339  Mat& to,
340  Mat& flow,
341  int layers,
342  int averaging_block_size,
343  int max_flow,
344  double sigma_dist,
345  double sigma_color,
346  int postprocess_window,
347  double sigma_dist_fix,
348  double sigma_color_fix,
349  double occ_thr,
350  int upscale_averaging_radius,
351  double upscale_sigma_dist,
352  double upscale_sigma_color,
353  double speed_up_thr);
354 
355 class CV_EXPORTS DenseOpticalFlow : public Algorithm
356 {
357 public:
358  virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow) = 0;
359  virtual void collectGarbage() = 0;
360 };
361 
362 // Implementation of the Zach, Pock and Bischof Dual TV-L1 Optical Flow method
363 //
364 // see reference:
365 // [1] C. Zach, T. Pock and H. Bischof, "A Duality Based Approach for Realtime TV-L1 Optical Flow".
366 // [2] Javier Sanchez, Enric Meinhardt-Llopis and Gabriele Facciolo. "TV-L1 Optical Flow Estimation".
368 
369 }
370 
371 #endif
372 
373 #endif
const CvArr CvArr CvArr const CvPoint2D32f CvPoint2D32f int CvSize int char * status
Definition: tracking.hpp:73
const _OutputArray & OutputArray
Definition: core.hpp:1449
CvMat * temp1
Definition: tracking.hpp:200
CvMat * error_cov_pre
Definition: tracking.hpp:194
GLint level
Definition: tracking.hpp:88
CV_EXPORTS_W void updateMotionHistory(InputArray silhouette, InputOutputArray mhi, double timestamp, double duration)
updates motion history image using the current silhouette
const CvArr CvMat * M
Definition: tracking.hpp:98
Mat controlMatrix
control matrix (B) (not used if there is no control)
Definition: tracking.hpp:283
CvArr CvArr * orientation
Definition: tracking.hpp:125
Size2i Size
Definition: core.hpp:896
CvMat * measurement_noise_cov
Definition: tracking.hpp:193
CvMat * state_pre
Definition: tracking.hpp:184
Mat statePost
corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
Definition: tracking.hpp:281
Definition: types_c.h:951
CvArr * mhi
Definition: tracking.hpp:120
Definition: types_c.h:1138
CvArr * seg_mask
Definition: tracking.hpp:138
Mat temp3
Definition: tracking.hpp:294
CV_EXPORTS_W double calcGlobalOrientation(InputArray orientation, InputArray mask, InputArray mhi, double timestamp, double duration)
computes the global orientation of the selected motion history image part
Definition: types_c.h:53
Definition: tracking.hpp:163
GLuint src
Definition: core_c.h:1650
Mat temp2
Definition: tracking.hpp:293
int int int flags
Definition: highgui_c.h:186
CV_EXPORTS_W RotatedRect CamShift(InputArray probImage, CV_OUT CV_IN_OUT Rect &window, TermCriteria criteria)
updates the object tracking window using CAMSHIFT algorithm
float * PNCovariance
Definition: tracking.hpp:176
Mat measurementMatrix
measurement matrix (H)
Definition: tracking.hpp:284
Mat processNoiseCov
process noise covariance matrix (Q)
Definition: tracking.hpp:285
Mat temp1
Definition: tracking.hpp:292
const CvArr CvArr double pyr_scale
Definition: tracking.hpp:102
float * MeasurementMatr
Definition: tracking.hpp:174
float * PriorState
Definition: tracking.hpp:172
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1312
CvArr double timestamp
Definition: tracking.hpp:120
CvMat * gain
Definition: tracking.hpp:196
CvMat * process_noise_cov
Definition: tracking.hpp:192
float * MNCovariance
Definition: tracking.hpp:175
Definition: tracking.hpp:355
const CvArr * B
Definition: tracking.hpp:98
GLint GLvoid * img
Definition: legacy.hpp:1150
const CvMat * measurement
Definition: tracking.hpp:220
const CvArr CvArr CvArr const CvPoint2D32f CvPoint2D32f int CvSize int char float * track_error
Definition: tracking.hpp:73
float * PriorErrorCovariance
Definition: tracking.hpp:178
const CvArr CvArr double int levels
Definition: tracking.hpp:102
struct CvKalman CvKalman
const _InputArray & InputArray
Definition: core.hpp:1447
int DP
Definition: tracking.hpp:166
the desired accuracy or change in parameters at which the iterative algorithm stops ...
Definition: core.hpp:2098
CV_EXPORTS_W void segmentMotion(InputArray mhi, OutputArray segmask, CV_OUT vector< Rect > &boundingRects, double timestamp, double segThresh)
const CvArr CvArr CvArr const CvPoint2D32f CvPoint2D32f * curr_features
Definition: tracking.hpp:73
CvMat * state_post
Definition: tracking.hpp:186
CV_EXPORTS_W void calcOpticalFlowPyrLK(InputArray prevImg, InputArray nextImg, InputArray prevPts, CV_OUT InputOutputArray nextPts, OutputArray status, OutputArray err, Size winSize=Size(21, 21), int maxLevel=3, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags=0, double minEigThreshold=1e-4)
computes sparse optical flow using multi-scale Lucas-Kanade algorithm
Definition: types_c.h:1272
CvMat * temp4
Definition: tracking.hpp:203
CvMat * control_matrix
Definition: tracking.hpp:189
CV_EXPORTS_W Mat estimateRigidTransform(InputArray src, InputArray dst, bool fullAffine)
estimates the best-fit Euqcidean, similarity, affine or perspective transformation ...
const CvArr CvArr double int int int int double poly_sigma
Definition: tracking.hpp:102
int MP
Definition: tracking.hpp:165
Mat statePre
predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
Definition: tracking.hpp:280
CvMat * transition_matrix
Definition: tracking.hpp:188
void CvArr
Definition: types_c.h:196
GLuint GLuint GLsizei count
Definition: core_c.h:973
Mat gain
Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
Definition: tracking.hpp:288
float * Temp1
Definition: tracking.hpp:180
Definition: tracking.hpp:303
float * KalmGainMatr
Definition: tracking.hpp:177
The Image Processing.
const CvArr CvArr * flow
Definition: tracking.hpp:102
const CvArr * curr
Definition: tracking.hpp:73
CvMat * temp3
Definition: tracking.hpp:202
OutputArray OutputArrayOfArrays
Definition: core.hpp:1450
CV_EXPORTS Ptr< DenseOpticalFlow > createOptFlow_DualTVL1()
Definition: types_c.h:645
const CvArr CvArr double int int int iterations
Definition: tracking.hpp:102
Definition: tracking.hpp:302
float * DynamMatr
Definition: tracking.hpp:173
The Core Functionality.
CV_EXPORTS_W void calcOpticalFlowSF(Mat &from, Mat &to, Mat &flow, int layers, int averaging_block_size, int max_flow)
computes dense optical flow using Simple Flow algorithm
the maximum number of iterations or elements to compute
Definition: core.hpp:2096
CVAPI(void) cvCalcOpticalFlowPyrLK(const CvArr *prev
Definition: imgproc.hpp:64
The n-dimensional matrix class.
Definition: core.hpp:1688
CvMat * temp5
Definition: tracking.hpp:204
Definition: types_c.h:997
OutputArray InputOutputArray
Definition: core.hpp:1451
CvMat * measurement_matrix
Definition: tracking.hpp:191
Mat transitionMatrix
state transition matrix (A)
Definition: tracking.hpp:282
Window window
Definition: tracking.hpp:154
GLuint GLuint GLsizei GLenum type
Definition: core_c.h:114
const CvArr CvArr * prev_pyr
Definition: tracking.hpp:73
Mat temp4
Definition: tracking.hpp:295
Definition: types_c.h:1173
Definition: imgproc.hpp:62
CvArr CvMemStorage double double seg_thresh
Definition: tracking.hpp:138
CvRect CvTermCriteria CvConnectedComp * comp
Definition: tracking.hpp:148
Mat measurementNoiseCov
measurement noise covariance matrix (R)
Definition: tracking.hpp:286
Base class for high-level OpenCV algorithms.
Definition: core.hpp:4390
Mat temp5
Definition: tracking.hpp:296
float * PosterErrorCovariance
Definition: tracking.hpp:179
Definition: types_c.h:1333
GLuint dst
Definition: calib3d.hpp:134
Definition: tracking.hpp:301
const CvArr CvArr double int int int int poly_n
Definition: tracking.hpp:102
const CvArr CvArr CvArr * curr_pyr
Definition: tracking.hpp:73
Kalman filter.
Definition: tracking.hpp:265
CvMat * error_cov_post
Definition: tracking.hpp:198
float * PosterState
Definition: tracking.hpp:171
Smart pointer to dynamically allocated objects.
Definition: core.hpp:1268
const CvArr CvArr double int int winsize
Definition: tracking.hpp:102
int measure_params
Definition: tracking.hpp:208
CV_EXPORTS_W int meanShift(InputArray probImage, CV_OUT CV_IN_OUT Rect &window, TermCriteria criteria)
updates the object tracking window using meanshift algorithm
Definition: types_c.h:1040
const CvArr CvArr CvArr const CvPoint2D32f CvPoint2D32f float * matrices
Definition: tracking.hpp:88
CvArr CvArr double delta1
Definition: tracking.hpp:125
GLenum GLint GLuint mask
Definition: tracking.hpp:132
Mat errorCovPre
priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
Definition: tracking.hpp:287
int CP
Definition: tracking.hpp:167
CV_EXPORTS_W void calcOpticalFlowFarneback(InputArray prev, InputArray next, CV_OUT InputOutputArray flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)
computes dense optical flow using Farneback algorithm
const CvArr CvArr CvArr const CvPoint2D32f * prev_features
Definition: tracking.hpp:73
const CvArr CvArr CvArr const CvPoint2D32f CvPoint2D32f int CvSize int char float CvTermCriteria criteria
Definition: tracking.hpp:73
CvArr CvArr double double int aperture_size CV_DEFAULT(3))
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1400
CvArr CvArr double double delta2
Definition: tracking.hpp:125
const CvArr CvArr CvArr const CvPoint2D32f CvPoint2D32f int CvSize win_size
Definition: tracking.hpp:73
CV_EXPORTS_W void calcMotionGradient(InputArray mhi, OutputArray mask, OutputArray orientation, double delta1, double delta2, int apertureSize=3)
computes the motion gradient orientation image from the motion history image
float * Temp2
Definition: tracking.hpp:181
Rect_< int > Rect
Definition: core.hpp:897
Mat errorCovPost
posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)
Definition: tracking.hpp:289
CvArr double double duration
Definition: tracking.hpp:120
const CvArr * next
Definition: tracking.hpp:102
const CvArr CvMat int full_affine
Definition: tracking.hpp:98
CvArr CvMemStorage * storage
Definition: tracking.hpp:138
CvMat * temp2
Definition: tracking.hpp:201
CV_EXPORTS_W int buildOpticalFlowPyramid(InputArray img, OutputArrayOfArrays pyramid, Size winSize, int maxLevel, bool withDerivatives=true, int pyrBorder=BORDER_REFLECT_101, int derivBorder=BORDER_CONSTANT, bool tryReuseInputImage=true)
constructs a pyramid which can be used as input for calcOpticalFlowPyrLK