legacy.hpp
Go to the documentation of this file.
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
8 //
9 //
10 // Intel License Agreement
11 // For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
15 //
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
18 //
19 // * Redistribution's of source code must retain the above copyright notice,
20 // this list of conditions and the following disclaimer.
21 //
22 // * Redistribution's in binary form must reproduce the above copyright notice,
23 // this list of conditions and the following disclaimer in the documentation
24 // and/or other materials provided with the distribution.
25 //
26 // * The name of Intel Corporation may not be used to endorse or promote products
27 // derived from this software without specific prior written permission.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 //M*/
41 
42 #ifndef __OPENCV_LEGACY_HPP__
43 #define __OPENCV_LEGACY_HPP__
44 
49 #include "opencv2/ml/ml.hpp"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 CVAPI(CvSeq*) cvSegmentImage( const CvArr* srcarr, CvArr* dstarr,
56  double canny_threshold,
57  double ffill_threshold,
59 
60 /****************************************************************************************\
61 * Eigen objects *
62 \****************************************************************************************/
63 
64 typedef int (CV_CDECL * CvCallback)(int index, void* buffer, void* user_data);
65 typedef union
66 {
68  void* data;
69 }
70 CvInput;
71 
72 #define CV_EIGOBJ_NO_CALLBACK 0
73 #define CV_EIGOBJ_INPUT_CALLBACK 1
74 #define CV_EIGOBJ_OUTPUT_CALLBACK 2
75 #define CV_EIGOBJ_BOTH_CALLBACK 3
76 
77 /* Calculates covariation matrix of a set of arrays */
78 CVAPI(void) cvCalcCovarMatrixEx( int nObjects, void* input, int ioFlags,
79  int ioBufSize, uchar* buffer, void* userData,
80  IplImage* avg, float* covarMatrix );
81 
82 /* Calculates eigen values and vectors of covariation matrix of a set of
83  arrays */
84 CVAPI(void) cvCalcEigenObjects( int nObjects, void* input, void* output,
85  int ioFlags, int ioBufSize, void* userData,
87  float* eigVals );
88 
89 /* Calculates dot product (obj - avg) * eigObj (i.e. projects image to eigen vector) */
90 CVAPI(double) cvCalcDecompCoeff( IplImage* obj, IplImage* eigObj, IplImage* avg );
91 
92 /* Projects image to eigen space (finds all decomposion coefficients */
93 CVAPI(void) cvEigenDecomposite( IplImage* obj, int nEigObjs, void* eigInput,
94  int ioFlags, void* userData, IplImage* avg,
95  float* coeffs );
96 
97 /* Projects original objects used to calculate eigen space basis to that space */
98 CVAPI(void) cvEigenProjection( void* eigInput, int nEigObjs, int ioFlags,
99  void* userData, float* coeffs, IplImage* avg,
100  IplImage* proj );
101 
102 /****************************************************************************************\
103 * 1D/2D HMM *
104 \****************************************************************************************/
105 
106 typedef struct CvImgObsInfo
107 {
108  int obs_x;
109  int obs_y;
110  int obs_size;
111  float* obs;//consequtive observations
112 
113  int* state;/* arr of pairs superstate/state to which observation belong */
114  int* mix; /* number of mixture to which observation belong */
115 
116 } CvImgObsInfo;/*struct for 1 image*/
117 
119 
120 typedef struct CvEHMMState
121 {
122  int num_mix; /*number of mixtures in this state*/
123  float* mu; /*mean vectors corresponding to each mixture*/
124  float* inv_var; /* square root of inversed variances corresp. to each mixture*/
125  float* log_var_val; /* sum of 0.5 (LN2PI + ln(variance[i]) ) for i=1,n */
126  float* weight; /*array of mixture weights. Summ of all weights in state is 1. */
127 
128 } CvEHMMState;
129 
130 typedef struct CvEHMM
131 {
132  int level; /* 0 - lowest(i.e its states are real states), ..... */
133  int num_states; /* number of HMM states */
134  float* transP;/*transition probab. matrices for states */
135  float** obsProb; /* if level == 0 - array of brob matrices corresponding to hmm
136  if level == 1 - martix of matrices */
137  union
138  {
139  CvEHMMState* state; /* if level == 0 points to real states array,
140  if not - points to embedded hmms */
141  struct CvEHMM* ehmm; /* pointer to an embedded model or NULL, if it is a leaf */
142  } u;
143 
144 } CvEHMM;
145 
146 /*CVAPI(int) icvCreate1DHMM( CvEHMM** this_hmm,
147  int state_number, int* num_mix, int obs_size );
148 
149 CVAPI(int) icvRelease1DHMM( CvEHMM** phmm );
150 
151 CVAPI(int) icvUniform1DSegm( Cv1DObsInfo* obs_info, CvEHMM* hmm );
152 
153 CVAPI(int) icvInit1DMixSegm( Cv1DObsInfo** obs_info_array, int num_img, CvEHMM* hmm);
154 
155 CVAPI(int) icvEstimate1DHMMStateParams( CvImgObsInfo** obs_info_array, int num_img, CvEHMM* hmm);
156 
157 CVAPI(int) icvEstimate1DObsProb( CvImgObsInfo* obs_info, CvEHMM* hmm );
158 
159 CVAPI(int) icvEstimate1DTransProb( Cv1DObsInfo** obs_info_array,
160  int num_seq,
161  CvEHMM* hmm );
162 
163 CVAPI(float) icvViterbi( Cv1DObsInfo* obs_info, CvEHMM* hmm);
164 
165 CVAPI(int) icv1DMixSegmL2( CvImgObsInfo** obs_info_array, int num_img, CvEHMM* hmm );*/
166 
167 /*********************************** Embedded HMMs *************************************/
168 
169 /* Creates 2D HMM */
170 CVAPI(CvEHMM*) cvCreate2DHMM( int* stateNumber, int* numMix, int obsSize );
171 
172 /* Releases HMM */
173 CVAPI(void) cvRelease2DHMM( CvEHMM** hmm );
174 
175 #define CV_COUNT_OBS(roi, win, delta, numObs ) \
176 { \
177  (numObs)->width =((roi)->width -(win)->width +(delta)->width)/(delta)->width; \
178  (numObs)->height =((roi)->height -(win)->height +(delta)->height)/(delta)->height;\
179 }
180 
181 /* Creates storage for observation vectors */
182 CVAPI(CvImgObsInfo*) cvCreateObsInfo( CvSize numObs, int obsSize );
183 
184 /* Releases storage for observation vectors */
185 CVAPI(void) cvReleaseObsInfo( CvImgObsInfo** obs_info );
186 
187 
188 /* The function takes an image on input and and returns the sequnce of observations
189  to be used with an embedded HMM; Each observation is top-left block of DCT
190  coefficient matrix */
191 CVAPI(void) cvImgToObs_DCT( const CvArr* arr, float* obs, CvSize dctSize,
192  CvSize obsSize, CvSize delta );
193 
194 
195 /* Uniformly segments all observation vectors extracted from image */
196 CVAPI(void) cvUniformImgSegm( CvImgObsInfo* obs_info, CvEHMM* ehmm );
197 
198 /* Does mixture segmentation of the states of embedded HMM */
199 CVAPI(void) cvInitMixSegm( CvImgObsInfo** obs_info_array,
200  int num_img, CvEHMM* hmm );
201 
202 /* Function calculates means, variances, weights of every Gaussian mixture
203  of every low-level state of embedded HMM */
204 CVAPI(void) cvEstimateHMMStateParams( CvImgObsInfo** obs_info_array,
205  int num_img, CvEHMM* hmm );
206 
207 /* Function computes transition probability matrices of embedded HMM
208  given observations segmentation */
209 CVAPI(void) cvEstimateTransProb( CvImgObsInfo** obs_info_array,
210  int num_img, CvEHMM* hmm );
211 
212 /* Function computes probabilities of appearing observations at any state
213  (i.e. computes P(obs|state) for every pair(obs,state)) */
214 CVAPI(void) cvEstimateObsProb( CvImgObsInfo* obs_info,
215  CvEHMM* hmm );
216 
217 /* Runs Viterbi algorithm for embedded HMM */
218 CVAPI(float) cvEViterbi( CvImgObsInfo* obs_info, CvEHMM* hmm );
219 
220 
221 /* Function clusters observation vectors from several images
222  given observations segmentation.
223  Euclidean distance used for clustering vectors.
224  Centers of clusters are given means of every mixture */
225 CVAPI(void) cvMixSegmL2( CvImgObsInfo** obs_info_array,
226  int num_img, CvEHMM* hmm );
227 
228 /****************************************************************************************\
229 * A few functions from old stereo gesture recognition demosions *
230 \****************************************************************************************/
231 
232 /* Creates hand mask image given several points on the hand */
233 CVAPI(void) cvCreateHandMask( CvSeq* hand_points,
235 
236 /* Finds hand region in range image data */
237 CVAPI(void) cvFindHandRegion (CvPoint3D32f* points, int count,
238  CvSeq* indexs,
239  float* line, CvSize2D32f size, int flag,
242 
243 /* Finds hand region in range image data (advanced version) */
244 CVAPI(void) cvFindHandRegionA( CvPoint3D32f* points, int count,
245  CvSeq* indexs,
246  float* line, CvSize2D32f size, int jc,
247  CvPoint3D32f* center,
248  CvMemStorage* storage, CvSeq **numbers);
249 
250 /* Calculates the cooficients of the homography matrix */
251 CVAPI(void) cvCalcImageHomography( float* line, CvPoint3D32f* center,
252  float* intrinsic, float* homography );
253 
254 /****************************************************************************************\
255 * More operations on sequences *
256 \****************************************************************************************/
257 
258 /*****************************************************************************************/
259 
260 #define CV_CURRENT_INT( reader ) (*((int *)(reader).ptr))
261 #define CV_PREV_INT( reader ) (*((int *)(reader).prev_elem))
262 
263 #define CV_GRAPH_WEIGHTED_VERTEX_FIELDS() CV_GRAPH_VERTEX_FIELDS()\
264  float weight;
265 
266 #define CV_GRAPH_WEIGHTED_EDGE_FIELDS() CV_GRAPH_EDGE_FIELDS()
267 
268 typedef struct CvGraphWeightedVtx
269 {
270  CV_GRAPH_WEIGHTED_VERTEX_FIELDS()
272 
273 typedef struct CvGraphWeightedEdge
274 {
275  CV_GRAPH_WEIGHTED_EDGE_FIELDS()
277 
278 typedef enum CvGraphWeightType
279 {
285 
286 
287 /* Calculates histogram of a contour */
288 CVAPI(void) cvCalcPGH( const CvSeq* contour, CvHistogram* hist );
289 
290 #define CV_DOMINANT_IPAN 1
291 
292 /* Finds high-curvature points of the contour */
293 CVAPI(CvSeq*) cvFindDominantPoints( CvSeq* contour, CvMemStorage* storage,
294  int method CV_DEFAULT(CV_DOMINANT_IPAN),
295  double parameter1 CV_DEFAULT(0),
296  double parameter2 CV_DEFAULT(0),
297  double parameter3 CV_DEFAULT(0),
298  double parameter4 CV_DEFAULT(0));
299 
300 /*****************************************************************************************/
301 
302 
303 /*******************************Stereo correspondence*************************************/
304 
305 typedef struct CvCliqueFinder
306 {
308  int** adj_matr;
309  int N; //graph size
310 
311  // stacks, counters etc/
312  int k; //stack size
314  int** All;
315 
316  int* ne;
317  int* ce;
318  int* fixp; //node with minimal disconnections
319  int* nod;
320  int* s; //for selected candidate
321  int status;
323  int weighted;
325  float best_weight;
326  float* edge_weights;
328  float* cur_weight;
329  float* cand_weight;
330 
332 
333 #define CLIQUE_TIME_OFF 2
334 #define CLIQUE_FOUND 1
335 #define CLIQUE_END 0
336 
337 /*CVAPI(void) cvStartFindCliques( CvGraph* graph, CvCliqueFinder* finder, int reverse,
338  int weighted CV_DEFAULT(0), int weighted_edges CV_DEFAULT(0));
339 CVAPI(int) cvFindNextMaximalClique( CvCliqueFinder* finder, int* clock_rest CV_DEFAULT(0) );
340 CVAPI(void) cvEndFindCliques( CvCliqueFinder* finder );
341 
342 CVAPI(void) cvBronKerbosch( CvGraph* graph );*/
343 
344 
345 /*F///////////////////////////////////////////////////////////////////////////////////////
346 //
347 // Name: cvSubgraphWeight
348 // Purpose: finds weight of subgraph in a graph
349 // Context:
350 // Parameters:
351 // graph - input graph.
352 // subgraph - sequence of pairwise different ints. These are indices of vertices of subgraph.
353 // weight_type - describes the way we measure weight.
354 // one of the following:
355 // CV_NOT_WEIGHTED - weight of a clique is simply its size
356 // CV_WEIGHTED_VTX - weight of a clique is the sum of weights of its vertices
357 // CV_WEIGHTED_EDGE - the same but edges
358 // CV_WEIGHTED_ALL - the same but both edges and vertices
359 // weight_vtx - optional vector of floats, with size = graph->total.
360 // If weight_type is either CV_WEIGHTED_VTX or CV_WEIGHTED_ALL
361 // weights of vertices must be provided. If weight_vtx not zero
362 // these weights considered to be here, otherwise function assumes
363 // that vertices of graph are inherited from CvGraphWeightedVtx.
364 // weight_edge - optional matrix of floats, of width and height = graph->total.
365 // If weight_type is either CV_WEIGHTED_EDGE or CV_WEIGHTED_ALL
366 // weights of edges ought to be supplied. If weight_edge is not zero
367 // function finds them here, otherwise function expects
368 // edges of graph to be inherited from CvGraphWeightedEdge.
369 // If this parameter is not zero structure of the graph is determined from matrix
370 // rather than from CvGraphEdge's. In particular, elements corresponding to
371 // absent edges should be zero.
372 // Returns:
373 // weight of subgraph.
374 // Notes:
375 //F*/
376 /*CVAPI(float) cvSubgraphWeight( CvGraph *graph, CvSeq *subgraph,
377  CvGraphWeightType weight_type CV_DEFAULT(CV_NOT_WEIGHTED),
378  CvVect32f weight_vtx CV_DEFAULT(0),
379  CvMatr32f weight_edge CV_DEFAULT(0) );*/
380 
381 
382 /*F///////////////////////////////////////////////////////////////////////////////////////
383 //
384 // Name: cvFindCliqueEx
385 // Purpose: tries to find clique with maximum possible weight in a graph
386 // Context:
387 // Parameters:
388 // graph - input graph.
389 // storage - memory storage to be used by the result.
390 // is_complementary - optional flag showing whether function should seek for clique
391 // in complementary graph.
392 // weight_type - describes our notion about weight.
393 // one of the following:
394 // CV_NOT_WEIGHTED - weight of a clique is simply its size
395 // CV_WEIGHTED_VTX - weight of a clique is the sum of weights of its vertices
396 // CV_WEIGHTED_EDGE - the same but edges
397 // CV_WEIGHTED_ALL - the same but both edges and vertices
398 // weight_vtx - optional vector of floats, with size = graph->total.
399 // If weight_type is either CV_WEIGHTED_VTX or CV_WEIGHTED_ALL
400 // weights of vertices must be provided. If weight_vtx not zero
401 // these weights considered to be here, otherwise function assumes
402 // that vertices of graph are inherited from CvGraphWeightedVtx.
403 // weight_edge - optional matrix of floats, of width and height = graph->total.
404 // If weight_type is either CV_WEIGHTED_EDGE or CV_WEIGHTED_ALL
405 // weights of edges ought to be supplied. If weight_edge is not zero
406 // function finds them here, otherwise function expects
407 // edges of graph to be inherited from CvGraphWeightedEdge.
408 // Note that in case of CV_WEIGHTED_EDGE or CV_WEIGHTED_ALL
409 // nonzero is_complementary implies nonzero weight_edge.
410 // start_clique - optional sequence of pairwise different ints. They are indices of
411 // vertices that shall be present in the output clique.
412 // subgraph_of_ban - optional sequence of (maybe equal) ints. They are indices of
413 // vertices that shall not be present in the output clique.
414 // clique_weight_ptr - optional output parameter. Weight of found clique stored here.
415 // num_generations - optional number of generations in evolutionary part of algorithm,
416 // zero forces to return first found clique.
417 // quality - optional parameter determining degree of required quality/speed tradeoff.
418 // Must be in the range from 0 to 9.
419 // 0 is fast and dirty, 9 is slow but hopefully yields good clique.
420 // Returns:
421 // sequence of pairwise different ints.
422 // These are indices of vertices that form found clique.
423 // Notes:
424 // in cases of CV_WEIGHTED_EDGE and CV_WEIGHTED_ALL weights should be nonnegative.
425 // start_clique has a priority over subgraph_of_ban.
426 //F*/
427 /*CVAPI(CvSeq*) cvFindCliqueEx( CvGraph *graph, CvMemStorage *storage,
428  int is_complementary CV_DEFAULT(0),
429  CvGraphWeightType weight_type CV_DEFAULT(CV_NOT_WEIGHTED),
430  CvVect32f weight_vtx CV_DEFAULT(0),
431  CvMatr32f weight_edge CV_DEFAULT(0),
432  CvSeq *start_clique CV_DEFAULT(0),
433  CvSeq *subgraph_of_ban CV_DEFAULT(0),
434  float *clique_weight_ptr CV_DEFAULT(0),
435  int num_generations CV_DEFAULT(3),
436  int quality CV_DEFAULT(2) );*/
437 
438 
439 #define CV_UNDEF_SC_PARAM 12345 //default value of parameters
440 
441 #define CV_IDP_BIRCHFIELD_PARAM1 25
442 #define CV_IDP_BIRCHFIELD_PARAM2 5
443 #define CV_IDP_BIRCHFIELD_PARAM3 12
444 #define CV_IDP_BIRCHFIELD_PARAM4 15
445 #define CV_IDP_BIRCHFIELD_PARAM5 25
446 
447 
448 #define CV_DISPARITY_BIRCHFIELD 0
449 
450 
451 /*F///////////////////////////////////////////////////////////////////////////
452 //
453 // Name: cvFindStereoCorrespondence
454 // Purpose: find stereo correspondence on stereo-pair
455 // Context:
456 // Parameters:
457 // leftImage - left image of stereo-pair (format 8uC1).
458 // rightImage - right image of stereo-pair (format 8uC1).
459 // mode - mode of correspondence retrieval (now CV_DISPARITY_BIRCHFIELD only)
460 // dispImage - destination disparity image
461 // maxDisparity - maximal disparity
462 // param1, param2, param3, param4, param5 - parameters of algorithm
463 // Returns:
464 // Notes:
465 // Images must be rectified.
466 // All images must have format 8uC1.
467 //F*/
468 CVAPI(void)
469 cvFindStereoCorrespondence(
470  const CvArr* leftImage, const CvArr* rightImage,
471  int mode,
472  CvArr* dispImage,
473  int maxDisparity,
474  double param1 CV_DEFAULT(CV_UNDEF_SC_PARAM),
475  double param2 CV_DEFAULT(CV_UNDEF_SC_PARAM),
476  double param3 CV_DEFAULT(CV_UNDEF_SC_PARAM),
477  double param4 CV_DEFAULT(CV_UNDEF_SC_PARAM),
478  double param5 CV_DEFAULT(CV_UNDEF_SC_PARAM) );
479 
480 /*****************************************************************************************/
481 /************ Epiline functions *******************/
482 
483 
484 
485 typedef struct CvStereoLineCoeff
486 {
487  double Xcoef;
488  double XcoefA;
489  double XcoefB;
490  double XcoefAB;
491 
492  double Ycoef;
493  double YcoefA;
494  double YcoefB;
495  double YcoefAB;
496 
497  double Zcoef;
498  double ZcoefA;
499  double ZcoefB;
500  double ZcoefAB;
502 
503 
504 typedef struct CvCamera
505 {
506  float imgSize[2]; /* size of the camera view, used during calibration */
507  float matrix[9]; /* intinsic camera parameters: [ fx 0 cx; 0 fy cy; 0 0 1 ] */
508  float distortion[4]; /* distortion coefficients - two coefficients for radial distortion
509  and another two for tangential: [ k1 k2 p1 p2 ] */
510  float rotMatr[9];
511  float transVect[3]; /* rotation matrix and transition vector relatively
512  to some reference point in the space. */
513 } CvCamera;
514 
515 typedef struct CvStereoCamera
516 {
517  CvCamera* camera[2]; /* two individual camera parameters */
518  float fundMatr[9]; /* fundamental matrix */
519 
520  /* New part for stereo */
522  CvPoint2D32f quad[2][4]; /* coordinates of destination quadrangle after
523  epipolar geometry rectification */
524  double coeffs[2][3][3];/* coefficients for transformation */
528  int needSwapCameras;/* flag set to 1 if need to swap cameras for good reconstruction */
529  float rotMatrix[9];
530  float transVector[3];
532 
533 
534 typedef struct CvContourOrientation
535 {
536  float egvals[2];
537  float egvects[4];
538 
539  float max, min; // minimum and maximum projections
540  int imax, imin;
542 
543 #define CV_CAMERA_TO_WARP 1
544 #define CV_WARP_TO_CAMERA 2
545 
546 CVAPI(int) icvConvertWarpCoordinates(double coeffs[3][3],
549  int direction);
550 
551 CVAPI(int) icvGetSymPoint3D( CvPoint3D64f pointCorner,
555 
556 CVAPI(void) icvGetPieceLength3D(CvPoint3D64f point1,CvPoint3D64f point2,double* dist);
557 
558 CVAPI(int) icvCompute3DPoint( double alpha,double betta,
559  CvStereoLineCoeff* coeffs,
561 
562 CVAPI(int) icvCreateConvertMatrVect( double* rotMatr1,
563  double* transVect1,
564  double* rotMatr2,
565  double* transVect2,
566  double* convRotMatr,
567  double* convTransVect);
568 
569 CVAPI(int) icvConvertPointSystem(CvPoint3D64f M2,
571  double* rotMatr,
572  double* transVect
573  );
574 
575 CVAPI(int) icvComputeCoeffForStereo( CvStereoCamera* stereoCamera);
576 
578 CVAPI(int) icvGetCrossLineDirect(CvPoint2D32f p1,CvPoint2D32f p2,float a,float b,float c,CvPoint2D32f* cross);
579 CVAPI(float) icvDefinePointPosition(CvPoint2D32f point1,CvPoint2D32f point2,CvPoint2D32f point);
580 CVAPI(int) icvStereoCalibration( int numImages,
581  int* nums,
587  );
588 
589 
590 CVAPI(int) icvComputeRestStereoParams(CvStereoCamera *stereoparams);
591 
592 CVAPI(void) cvComputePerspectiveMap( const double coeffs[3][3], CvArr* rectMapX, CvArr* rectMapY );
593 
594 CVAPI(int) icvComCoeffForLine( CvPoint2D64f point1,
595  CvPoint2D64f point2,
598  double* camMatr1,
599  double* rotMatr1,
600  double* transVect1,
601  double* camMatr2,
602  double* rotMatr2,
603  double* transVect2,
604  CvStereoLineCoeff* coeffs,
605  int* needSwapCameras);
606 
607 CVAPI(int) icvGetDirectionForPoint( CvPoint2D64f point,
608  double* camMatr,
610 
614 
615 CVAPI(int) icvComputeStereoLineCoeffs( CvPoint3D64f pointA,
618  double gamma,
619  CvStereoLineCoeff* coeffs);
620 
621 /*CVAPI(int) icvComputeFundMatrEpipoles ( double* camMatr1,
622  double* rotMatr1,
623  double* transVect1,
624  double* camMatr2,
625  double* rotMatr2,
626  double* transVect2,
627  CvPoint2D64f* epipole1,
628  CvPoint2D64f* epipole2,
629  double* fundMatr);*/
630 
631 CVAPI(int) icvGetAngleLine( CvPoint2D64f startPoint, CvSize imageSize,CvPoint2D64f *point1,CvPoint2D64f *point2);
632 
633 CVAPI(void) icvGetCoefForPiece( CvPoint2D64f p_start,CvPoint2D64f p_end,
634  double *a,double *b,double *c,
635  int* result);
636 
637 /*CVAPI(void) icvGetCommonArea( CvSize imageSize,
638  CvPoint2D64f epipole1,CvPoint2D64f epipole2,
639  double* fundMatr,
640  double* coeff11,double* coeff12,
641  double* coeff21,double* coeff22,
642  int* result);*/
643 
644 CVAPI(void) icvComputeeInfiniteProject1(double* rotMatr,
645  double* camMatr1,
646  double* camMatr2,
647  CvPoint2D32f point1,
648  CvPoint2D32f *point2);
649 
650 CVAPI(void) icvComputeeInfiniteProject2(double* rotMatr,
651  double* camMatr1,
652  double* camMatr2,
653  CvPoint2D32f* point1,
654  CvPoint2D32f point2);
655 
656 CVAPI(void) icvGetCrossDirectDirect( double* direct1,double* direct2,
657  CvPoint2D64f *cross,int* result);
658 
659 CVAPI(void) icvGetCrossPieceDirect( CvPoint2D64f p_start,CvPoint2D64f p_end,
660  double a,double b,double c,
661  CvPoint2D64f *cross,int* result);
662 
663 CVAPI(void) icvGetCrossPiecePiece( CvPoint2D64f p1_start,CvPoint2D64f p1_end,
665  CvPoint2D64f* cross,
666  int* result);
667 
668 CVAPI(void) icvGetPieceLength(CvPoint2D64f point1,CvPoint2D64f point2,double* dist);
669 
670 CVAPI(void) icvGetCrossRectDirect( CvSize imageSize,
671  double a,double b,double c,
673  int* result);
674 
675 CVAPI(void) icvProjectPointToImage( CvPoint3D64f point,
676  double* camMatr,double* rotMatr,double* transVect,
678 
679 CVAPI(void) icvGetQuadsTransform( CvSize imageSize,
680  double* camMatr1,
681  double* rotMatr1,
682  double* transVect1,
683  double* camMatr2,
684  double* rotMatr2,
685  double* transVect2,
686  CvSize* warpSize,
687  double quad1[4][2],
688  double quad2[4][2],
689  double* fundMatr,
692  );
693 
694 CVAPI(void) icvGetQuadsTransformStruct( CvStereoCamera* stereoCamera);
695 
696 CVAPI(void) icvComputeStereoParamsForCameras(CvStereoCamera* stereoCamera);
697 
698 CVAPI(void) icvGetCutPiece( double* areaLineCoef1,double* areaLineCoef2,
700  CvSize imageSize,
701  CvPoint2D64f* point11,CvPoint2D64f* point12,
702  CvPoint2D64f* point21,CvPoint2D64f* point22,
703  int* result);
704 
705 CVAPI(void) icvGetMiddleAnglePoint( CvPoint2D64f basePoint,
706  CvPoint2D64f point1,CvPoint2D64f point2,
707  CvPoint2D64f* midPoint);
708 
709 CVAPI(void) icvGetNormalDirect(double* direct,CvPoint2D64f point,double* normDirect);
710 
711 CVAPI(double) icvGetVect(CvPoint2D64f basePoint,CvPoint2D64f point1,CvPoint2D64f point2);
712 
713 CVAPI(void) icvProjectPointToDirect( CvPoint2D64f point,double* lineCoeff,
715 
716 CVAPI(void) icvGetDistanceFromPointToDirect( CvPoint2D64f point,double* lineCoef,double*dist);
717 
718 CVAPI(IplImage*) icvCreateIsometricImage( IplImage* src, IplImage* dst,
720 
721 CVAPI(void) cvDeInterlace( const CvArr* frame, CvArr* fieldEven, CvArr* fieldOdd );
722 
723 /*CVAPI(int) icvSelectBestRt( int numImages,
724  int* numPoints,
725  CvSize imageSize,
726  CvPoint2D32f* imagePoints1,
727  CvPoint2D32f* imagePoints2,
728  CvPoint3D32f* objectPoints,
729 
730  CvMatr32f cameraMatrix1,
731  CvVect32f distortion1,
732  CvMatr32f rotMatrs1,
733  CvVect32f transVects1,
734 
735  CvMatr32f cameraMatrix2,
736  CvVect32f distortion2,
737  CvMatr32f rotMatrs2,
738  CvVect32f transVects2,
739 
740  CvMatr32f bestRotMatr,
741  CvVect32f bestTransVect
742  );*/
743 
744 
745 /****************************************************************************************\
746 * Contour Tree *
747 \****************************************************************************************/
748 
749 /* Contour tree header */
750 typedef struct CvContourTree
751 {
752  CV_SEQUENCE_FIELDS()
753  CvPoint p1; /* the first point of the binary tree root segment */
754  CvPoint p2; /* the last point of the binary tree root segment */
755 } CvContourTree;
756 
757 /* Builds hierarhical representation of a contour */
758 CVAPI(CvContourTree*) cvCreateContourTree( const CvSeq* contour,
759  CvMemStorage* storage,
760  double threshold );
761 
762 /* Reconstruct (completelly or partially) contour a from contour tree */
763 CVAPI(CvSeq*) cvContourFromContourTree( const CvContourTree* tree,
764  CvMemStorage* storage,
766 
767 /* Compares two contour trees */
769 
770 CVAPI(double) cvMatchContourTrees( const CvContourTree* tree1,
772  int method, double threshold );
773 
774 /****************************************************************************************\
775 * Contour Morphing *
776 \****************************************************************************************/
777 
778 /* finds correspondence between two contours */
779 CvSeq* cvCalcContoursCorrespondence( const CvSeq* contour1,
780  const CvSeq* contour2,
781  CvMemStorage* storage);
782 
783 /* morphs contours using the pre-calculated correspondence:
784  alpha=0 ~ contour1, alpha=1 ~ contour2 */
785 CvSeq* cvMorphContours( const CvSeq* contour1, const CvSeq* contour2,
786  CvSeq* corr, double alpha,
787  CvMemStorage* storage );
788 
789 
790 /****************************************************************************************\
791 * Active Contours *
792 \****************************************************************************************/
793 
794 #define CV_VALUE 1
795 #define CV_ARRAY 2
796 /* Updates active contour in order to minimize its cummulative
797  (internal and external) energy. */
798 CVAPI(void) cvSnakeImage( const IplImage* image, CvPoint* points,
799  int length, float* alpha,
800  float* beta, float* gamma,
801  int coeff_usage, CvSize win,
802  CvTermCriteria criteria, int calc_gradient CV_DEFAULT(1));
803 
804 /****************************************************************************************\
805 * Texture Descriptors *
806 \****************************************************************************************/
807 
808 #define CV_GLCM_OPTIMIZATION_NONE -2
809 #define CV_GLCM_OPTIMIZATION_LUT -1
810 #define CV_GLCM_OPTIMIZATION_HISTOGRAM 0
811 
812 #define CV_GLCMDESC_OPTIMIZATION_ALLOWDOUBLENEST 10
813 #define CV_GLCMDESC_OPTIMIZATION_ALLOWTRIPLENEST 11
814 #define CV_GLCMDESC_OPTIMIZATION_HISTOGRAM 4
815 
816 #define CV_GLCMDESC_ENTROPY 0
817 #define CV_GLCMDESC_ENERGY 1
818 #define CV_GLCMDESC_HOMOGENITY 2
819 #define CV_GLCMDESC_CONTRAST 3
820 #define CV_GLCMDESC_CLUSTERTENDENCY 4
821 #define CV_GLCMDESC_CLUSTERSHADE 5
822 #define CV_GLCMDESC_CORRELATION 6
823 #define CV_GLCMDESC_CORRELATIONINFO1 7
824 #define CV_GLCMDESC_CORRELATIONINFO2 8
825 #define CV_GLCMDESC_MAXIMUMPROBABILITY 9
826 
827 #define CV_GLCM_ALL 0
828 #define CV_GLCM_GLCM 1
829 #define CV_GLCM_DESC 2
830 
831 typedef struct CvGLCM CvGLCM;
832 
833 CVAPI(CvGLCM*) cvCreateGLCM( const IplImage* srcImage,
835  const int* stepDirections CV_DEFAULT(0),
836  int numStepDirections CV_DEFAULT(0),
837  int optimizationType CV_DEFAULT(CV_GLCM_OPTIMIZATION_NONE));
838 
839 CVAPI(void) cvReleaseGLCM( CvGLCM** GLCM, int flag CV_DEFAULT(CV_GLCM_ALL));
840 
841 CVAPI(void) cvCreateGLCMDescriptors( CvGLCM* destGLCM,
842  int descriptorOptimizationType
843  CV_DEFAULT(CV_GLCMDESC_OPTIMIZATION_ALLOWDOUBLENEST));
844 
845 CVAPI(double) cvGetGLCMDescriptor( CvGLCM* GLCM, int step, int descriptor );
846 
847 CVAPI(void) cvGetGLCMDescriptorStatistics( CvGLCM* GLCM, int descriptor,
848  double* average, double* standardDeviation );
849 
850 CVAPI(IplImage*) cvCreateGLCMImage( CvGLCM* GLCM, int step );
851 
852 /****************************************************************************************\
853 * Face eyes&mouth tracking *
854 \****************************************************************************************/
855 
856 
858 
859 #define CV_NUM_FACE_ELEMENTS 3
861 {
865 };
866 
867 CVAPI(CvFaceTracker*) cvInitFaceTracker(CvFaceTracker* pFaceTracking, const IplImage* imgGray,
868  CvRect* pRects, int nRects);
869 CVAPI(int) cvTrackFace( CvFaceTracker* pFaceTracker, IplImage* imgGray,
870  CvRect* pRects, int nRects,
871  CvPoint* ptRotate, double* dbAngleRotate);
872 CVAPI(void) cvReleaseFaceTracker(CvFaceTracker** ppFaceTracker);
873 
874 
875 typedef struct CvFace
876 {
880 } CvFaceData;
881 
882 CvSeq * cvFindFace(IplImage * Image,CvMemStorage* storage);
884 
885 
886 /****************************************************************************************\
887 * 3D Tracker *
888 \****************************************************************************************/
889 
890 typedef unsigned char CvBool;
891 
893 {
894  int id;
895  CvPoint2D32f p; // pgruebele: So we do not loose precision, this needs to be float
897 
899 {
901  r.id = id;
902  r.p = p;
903  return r;
904 }
905 
907 {
908  int id;
909  CvPoint3D32f p; // location of the tracked object
911 
913 {
915  r.id = id;
916  r.p = p;
917  return r;
918 }
919 
920 typedef struct Cv3dTrackerCameraInfo
921 {
922  CvBool valid;
923  float mat[4][4]; /* maps camera coordinates to world coordinates */
924  CvPoint2D32f principal_point; /* copied from intrinsics so this structure */
925  /* has all the info we need */
927 
929 {
931  float focal_length[2];
932  float distortion[4];
934 
935 CVAPI(CvBool) cv3dTrackerCalibrateCameras(int num_cameras,
936  const Cv3dTrackerCameraIntrinsics camera_intrinsics[], /* size is num_cameras */
938  float square_size,
939  IplImage *samples[], /* size is num_cameras */
940  Cv3dTrackerCameraInfo camera_info[]); /* size is num_cameras */
941 
942 CVAPI(int) cv3dTrackerLocateObjects(int num_cameras, int num_objects,
943  const Cv3dTrackerCameraInfo camera_info[], /* size is num_cameras */
944  const Cv3dTracker2dTrackedObject tracking_info[], /* size is num_objects*num_cameras */
945  Cv3dTrackerTrackedObject tracked_objects[]); /* size is num_objects */
946 /****************************************************************************************
947  tracking_info is a rectangular array; one row per camera, num_objects elements per row.
948  The id field of any unused slots must be -1. Ids need not be ordered or consecutive. On
949  completion, the return value is the number of objects located; i.e., the number of objects
950  visible by more than one camera. The id field of any unused slots in tracked objects is
951  set to -1.
952 ****************************************************************************************/
953 
954 
955 /****************************************************************************************\
956 * Skeletons and Linear-Contour Models *
957 \****************************************************************************************/
958 
959 typedef enum CvLeeParameters
960 {
969 
970 #define CV_NEXT_VORONOISITE2D( SITE ) ((SITE)->edge[0]->site[((SITE)->edge[0]->site[0] == (SITE))])
971 #define CV_PREV_VORONOISITE2D( SITE ) ((SITE)->edge[1]->site[((SITE)->edge[1]->site[0] == (SITE))])
972 #define CV_FIRST_VORONOIEDGE2D( SITE ) ((SITE)->edge[0])
973 #define CV_LAST_VORONOIEDGE2D( SITE ) ((SITE)->edge[1])
974 #define CV_NEXT_VORONOIEDGE2D( EDGE, SITE ) ((EDGE)->next[(EDGE)->site[0] != (SITE)])
975 #define CV_PREV_VORONOIEDGE2D( EDGE, SITE ) ((EDGE)->next[2 + ((EDGE)->site[0] != (SITE))])
976 #define CV_VORONOIEDGE2D_BEGINNODE( EDGE, SITE ) ((EDGE)->node[((EDGE)->site[0] != (SITE))])
977 #define CV_VORONOIEDGE2D_ENDNODE( EDGE, SITE ) ((EDGE)->node[((EDGE)->site[0] == (SITE))])
978 #define CV_TWIN_VORONOISITE2D( SITE, EDGE ) ( (EDGE)->site[((EDGE)->site[0] == (SITE))])
979 
980 #define CV_VORONOISITE2D_FIELDS() \
981  struct CvVoronoiNode2D *node[2]; \
982  struct CvVoronoiEdge2D *edge[2];
983 
984 typedef struct CvVoronoiSite2D
985 {
987  struct CvVoronoiSite2D *next[2];
989 
990 #define CV_VORONOIEDGE2D_FIELDS() \
991  struct CvVoronoiNode2D *node[2]; \
992  struct CvVoronoiSite2D *site[2]; \
993  struct CvVoronoiEdge2D *next[4];
994 
995 typedef struct CvVoronoiEdge2D
996 {
997  CV_VORONOIEDGE2D_FIELDS()
999 
1000 #define CV_VORONOINODE2D_FIELDS() \
1001  CV_SET_ELEM_FIELDS(CvVoronoiNode2D) \
1002  CvPoint2D32f pt; \
1003  float radius;
1004 
1005 typedef struct CvVoronoiNode2D
1006 {
1007  CV_VORONOINODE2D_FIELDS()
1008 } CvVoronoiNode2D;
1009 
1010 #define CV_VORONOIDIAGRAM2D_FIELDS() \
1011  CV_GRAPH_FIELDS() \
1012  CvSet *sites;
1013 
1014 typedef struct CvVoronoiDiagram2D
1015 {
1016  CV_VORONOIDIAGRAM2D_FIELDS()
1018 
1019 /* Computes Voronoi Diagram for given polygons with holes */
1020 CVAPI(int) cvVoronoiDiagramFromContour(CvSeq* ContourSeq,
1023  CvLeeParameters contour_type CV_DEFAULT(CV_LEE_INT),
1024  int contour_orientation CV_DEFAULT(-1),
1025  int attempt_number CV_DEFAULT(10));
1026 
1027 /* Computes Voronoi Diagram for domains in given image */
1028 CVAPI(int) cvVoronoiDiagramFromImage(IplImage* pImage,
1029  CvSeq** ContourSeq,
1030  CvVoronoiDiagram2D** VoronoiDiagram,
1031  CvMemStorage* VoronoiStorage,
1032  CvLeeParameters regularization_method CV_DEFAULT(CV_LEE_NON),
1033  float approx_precision CV_DEFAULT(CV_LEE_AUTO));
1034 
1035 /* Deallocates the storage */
1036 CVAPI(void) cvReleaseVoronoiStorage(CvVoronoiDiagram2D* VoronoiDiagram,
1038 
1039 /*********************** Linear-Contour Model ****************************/
1040 
1041 struct CvLCMEdge;
1042 struct CvLCMNode;
1043 
1044 typedef struct CvLCMEdge
1045 {
1046  CV_GRAPH_EDGE_FIELDS()
1047  CvSeq* chain;
1048  float width;
1049  int index1;
1050  int index2;
1051 } CvLCMEdge;
1052 
1053 typedef struct CvLCMNode
1054 {
1056  CvContour* contour;
1057 } CvLCMNode;
1058 
1059 
1060 /* Computes hybrid model from Voronoi Diagram */
1061 CVAPI(CvGraph*) cvLinearContorModelFromVoronoiDiagram(CvVoronoiDiagram2D* VoronoiDiagram,
1062  float maxWidth);
1063 
1064 /* Releases hybrid model storage */
1065 CVAPI(int) cvReleaseLinearContorModelStorage(CvGraph** Graph);
1066 
1067 
1068 /* two stereo-related functions */
1069 
1070 CVAPI(void) cvInitPerspectiveTransform( CvSize size, const CvPoint2D32f vertex[4], double matrix[3][3],
1071  CvArr* rectMap );
1072 
1073 /*CVAPI(void) cvInitStereoRectification( CvStereoCamera* params,
1074  CvArr* rectMap1, CvArr* rectMap2,
1075  int do_undistortion );*/
1076 
1077 /*************************** View Morphing Functions ************************/
1078 
1079 typedef struct CvMatrix3
1080 {
1081  float m[3][3];
1082 } CvMatrix3;
1083 
1084 /* The order of the function corresponds to the order they should appear in
1085  the view morphing pipeline */
1086 
1087 /* Finds ending points of scanlines on left and right images of stereo-pair */
1088 CVAPI(void) cvMakeScanlines( const CvMatrix3* matrix, CvSize img_size,
1089  int* scanlines1, int* scanlines2,
1090  int* lengths1, int* lengths2,
1091  int* line_count );
1092 
1093 /* Grab pixel values from scanlines and stores them sequentially
1094  (some sort of perspective image transform) */
1095 CVAPI(void) cvPreWarpImage( int line_count,
1097  uchar* dst,
1098  int* dst_nums,
1099  int* scanlines);
1100 
1101 /* Approximate each grabbed scanline by a sequence of runs
1102  (lossy run-length compression) */
1103 CVAPI(void) cvFindRuns( int line_count,
1105  uchar* prewarp2,
1106  int* line_lengths1,
1107  int* line_lengths2,
1108  int* runs1,
1109  int* runs2,
1110  int* num_runs1,
1111  int* num_runs2);
1112 
1113 /* Compares two sets of compressed scanlines */
1114 CVAPI(void) cvDynamicCorrespondMulti( int line_count,
1115  int* first,
1116  int* first_runs,
1117  int* second,
1118  int* second_runs,
1119  int* first_corr,
1120  int* second_corr);
1121 
1122 /* Finds scanline ending coordinates for some intermediate "virtual" camera position */
1123 CVAPI(void) cvMakeAlphaScanlines( int* scanlines1,
1124  int* scanlines2,
1125  int* scanlinesA,
1126  int* lengths,
1127  int line_count,
1128  float alpha);
1129 
1130 /* Blends data of the left and right image scanlines to get
1131  pixel values of "virtual" image scanlines */
1132 CVAPI(void) cvMorphEpilinesMulti( int line_count,
1134  int* first_num,
1135  uchar* second_pix,
1136  int* second_num,
1137  uchar* dst_pix,
1138  int* dst_num,
1139  float alpha,
1140  int* first,
1141  int* first_runs,
1142  int* second,
1143  int* second_runs,
1144  int* first_corr,
1145  int* second_corr);
1146 
1147 /* Does reverse warping of the morphing result to make
1148  it fill the destination image rectangle */
1149 CVAPI(void) cvPostWarpImage( int line_count,
1151  int* src_nums,
1152  IplImage* img,
1153  int* scanlines);
1154 
1155 /* Deletes Moire (missed pixels that appear due to discretization) */
1156 CVAPI(void) cvDeleteMoire( IplImage* img );
1157 
1158 
1159 typedef struct CvConDensation
1160 {
1161  int MP;
1162  int DP;
1163  float* DynamMatr; /* Matrix of the linear Dynamics system */
1164  float* State; /* Vector of State */
1165  int SamplesNum; /* Number of the Samples */
1166  float** flSamples; /* arr of the Sample Vectors */
1167  float** flNewSamples; /* temporary array of the Sample Vectors */
1168  float* flConfidence; /* Confidence for each Sample */
1169  float* flCumulative; /* Cumulative confidence */
1170  float* Temp; /* Temporary vector */
1171  float* RandomSample; /* RandomVector to update sample set */
1172  struct CvRandState* RandS; /* Array of structures to generate random vectors */
1173 } CvConDensation;
1174 
1175 /* Creates ConDensation filter state */
1176 CVAPI(CvConDensation*) cvCreateConDensation( int dynam_params,
1178  int sample_count );
1179 
1180 /* Releases ConDensation filter state */
1181 CVAPI(void) cvReleaseConDensation( CvConDensation** condens );
1182 
1183 /* Updates ConDensation filter by time (predict future state of the system) */
1184 CVAPI(void) cvConDensUpdateByTime( CvConDensation* condens);
1185 
1186 /* Initializes ConDensation filter samples */
1187 CVAPI(void) cvConDensInitSampleSet( CvConDensation* condens, CvMat* lower_bound, CvMat* upper_bound );
1188 
1189 CV_INLINE int iplWidth( const IplImage* img )
1190 {
1191  return !img ? 0 : !img->roi ? img->width : img->roi->width;
1192 }
1193 
1194 CV_INLINE int iplHeight( const IplImage* img )
1195 {
1196  return !img ? 0 : !img->roi ? img->height : img->roi->height;
1197 }
1198 
1199 #ifdef __cplusplus
1200 }
1201 #endif
1202 
1203 #ifdef __cplusplus
1204 
1205 /****************************************************************************************\
1206 * Calibration engine *
1207 \****************************************************************************************/
1208 
1209 typedef enum CvCalibEtalonType
1210 {
1214 }
1216 
1217 class CV_EXPORTS CvCalibFilter
1218 {
1219 public:
1220  /* Constructor & destructor */
1221  CvCalibFilter();
1222  virtual ~CvCalibFilter();
1223 
1224  /* Sets etalon type - one for all cameras.
1225  etalonParams is used in case of pre-defined etalons (such as chessboard).
1226  Number of elements in etalonParams is determined by etalonType.
1227  E.g., if etalon type is CV_ETALON_TYPE_CHESSBOARD then:
1228  etalonParams[0] is number of squares per one side of etalon
1229  etalonParams[1] is number of squares per another side of etalon
1230  etalonParams[2] is linear size of squares in the board in arbitrary units.
1231  pointCount & points are used in case of
1232  CV_CALIB_ETALON_USER (user-defined) etalon. */
1233  virtual bool
1234  SetEtalon( CvCalibEtalonType etalonType, double* etalonParams,
1235  int pointCount = 0, CvPoint2D32f* points = 0 );
1236 
1237  /* Retrieves etalon parameters/or and points */
1238  virtual CvCalibEtalonType
1239  GetEtalon( int* paramCount = 0, const double** etalonParams = 0,
1240  int* pointCount = 0, const CvPoint2D32f** etalonPoints = 0 ) const;
1241 
1242  /* Sets number of cameras calibrated simultaneously. It is equal to 1 initially */
1243  virtual void SetCameraCount( int cameraCount );
1244 
1245  /* Retrieves number of cameras */
1246  int GetCameraCount() const { return cameraCount; }
1247 
1248  /* Starts cameras calibration */
1249  virtual bool SetFrames( int totalFrames );
1250 
1251  /* Stops cameras calibration */
1252  virtual void Stop( bool calibrate = false );
1253 
1254  /* Retrieves number of cameras */
1255  bool IsCalibrated() const { return isCalibrated; }
1256 
1257  /* Feeds another serie of snapshots (one per each camera) to filter.
1258  Etalon points on these images are found automatically.
1259  If the function can't locate points, it returns false */
1260  virtual bool FindEtalon( IplImage** imgs );
1261 
1262  /* The same but takes matrices */
1263  virtual bool FindEtalon( CvMat** imgs );
1264 
1265  /* Lower-level function for feeding filter with already found etalon points.
1266  Array of point arrays for each camera is passed. */
1267  virtual bool Push( const CvPoint2D32f** points = 0 );
1268 
1269  /* Returns total number of accepted frames and, optionally,
1270  total number of frames to collect */
1271  virtual int GetFrameCount( int* framesTotal = 0 ) const;
1272 
1273  /* Retrieves camera parameters for specified camera.
1274  If camera is not calibrated the function returns 0 */
1275  virtual const CvCamera* GetCameraParams( int idx = 0 ) const;
1276 
1277  virtual const CvStereoCamera* GetStereoParams() const;
1278 
1279  /* Sets camera parameters for all cameras */
1280  virtual bool SetCameraParams( CvCamera* params );
1281 
1282  /* Saves all camera parameters to file */
1283  virtual bool SaveCameraParams( const char* filename );
1284 
1285  /* Loads all camera parameters from file */
1286  virtual bool LoadCameraParams( const char* filename );
1287 
1288  /* Undistorts images using camera parameters. Some of src pointers can be NULL. */
1289  virtual bool Undistort( IplImage** src, IplImage** dst );
1290 
1291  /* Undistorts images using camera parameters. Some of src pointers can be NULL. */
1292  virtual bool Undistort( CvMat** src, CvMat** dst );
1293 
1294  /* Returns array of etalon points detected/partally detected
1295  on the latest frame for idx-th camera */
1296  virtual bool GetLatestPoints( int idx, CvPoint2D32f** pts,
1297  int* count, bool* found );
1298 
1299  /* Draw the latest detected/partially detected etalon */
1300  virtual void DrawPoints( IplImage** dst );
1301 
1302  /* Draw the latest detected/partially detected etalon */
1303  virtual void DrawPoints( CvMat** dst );
1304 
1305  virtual bool Rectify( IplImage** srcarr, IplImage** dstarr );
1306  virtual bool Rectify( CvMat** srcarr, CvMat** dstarr );
1307 
1308 protected:
1309 
1310  enum { MAX_CAMERAS = 3 };
1311 
1312  /* etalon data */
1315  double* etalonParams;
1322 
1323  /* camera data */
1325  CvCamera cameraParams[MAX_CAMERAS];
1327  CvPoint2D32f* points[MAX_CAMERAS];
1328  CvMat* undistMap[MAX_CAMERAS][2];
1330  int latestCounts[MAX_CAMERAS];
1331  CvPoint2D32f* latestPoints[MAX_CAMERAS];
1332  CvMat* rectMap[MAX_CAMERAS][2];
1333 
1334  /* Added by Valery */
1335  //CvStereoCamera stereoParams;
1336 
1341 };
1342 
1343 #include <iosfwd>
1344 #include <limits>
1345 
1346 class CV_EXPORTS CvImage
1347 {
1348 public:
1349  CvImage() : image(0), refcount(0) {}
1350  CvImage( CvSize _size, int _depth, int _channels )
1351  {
1352  image = cvCreateImage( _size, _depth, _channels );
1353  refcount = image ? new int(1) : 0;
1354  }
1355 
1356  CvImage( IplImage* img ) : image(img)
1357  {
1358  refcount = image ? new int(1) : 0;
1359  }
1360 
1361  CvImage( const CvImage& img ) : image(img.image), refcount(img.refcount)
1362  {
1363  if( refcount ) ++(*refcount);
1364  }
1365 
1366  CvImage( const char* filename, const char* imgname=0, int color=-1 ) : image(0), refcount(0)
1367  { load( filename, imgname, color ); }
1368 
1369  CvImage( CvFileStorage* fs, const char* mapname, const char* imgname ) : image(0), refcount(0)
1370  { read( fs, mapname, imgname ); }
1371 
1372  CvImage( CvFileStorage* fs, const char* seqname, int idx ) : image(0), refcount(0)
1373  { read( fs, seqname, idx ); }
1374 
1376  {
1377  if( refcount && !(--*refcount) )
1378  {
1379  cvReleaseImage( &image );
1380  delete refcount;
1381  }
1382  }
1383 
1384  CvImage clone() { return CvImage(image ? cvCloneImage(image) : 0); }
1385 
1386  void create( CvSize _size, int _depth, int _channels )
1387  {
1388  if( !image || !refcount ||
1389  image->width != _size.width || image->height != _size.height ||
1390  image->depth != _depth || image->nChannels != _channels )
1391  attach( cvCreateImage( _size, _depth, _channels ));
1392  }
1393 
1394  void release() { detach(); }
1395  void clear() { detach(); }
1396 
1397  void attach( IplImage* img, bool use_refcount=true )
1398  {
1399  if( refcount && --*refcount == 0 )
1400  {
1401  cvReleaseImage( &image );
1402  delete refcount;
1403  }
1404  image = img;
1405  refcount = use_refcount && image ? new int(1) : 0;
1406  }
1407 
1408  void detach()
1409  {
1410  if( refcount && --*refcount == 0 )
1411  {
1412  cvReleaseImage( &image );
1413  delete refcount;
1414  }
1415  image = 0;
1416  refcount = 0;
1417  }
1418 
1419  bool load( const char* filename, const char* imgname=0, int color=-1 );
1420  bool read( CvFileStorage* fs, const char* mapname, const char* imgname );
1421  bool read( CvFileStorage* fs, const char* seqname, int idx );
1422  void save( const char* filename, const char* imgname, const int* params=0 );
1423  void write( CvFileStorage* fs, const char* imgname );
1424 
1425  void show( const char* window_name );
1426  bool is_valid() { return image != 0; }
1427 
1428  int width() const { return image ? image->width : 0; }
1429  int height() const { return image ? image->height : 0; }
1430 
1431  CvSize size() const { return image ? cvSize(image->width, image->height) : cvSize(0,0); }
1432 
1434  {
1435  return !image ? cvSize(0,0) :
1436  !image->roi ? cvSize(image->width,image->height) :
1437  cvSize(image->roi->width, image->roi->height);
1438  }
1439 
1440  CvRect roi() const
1441  {
1442  return !image ? cvRect(0,0,0,0) :
1443  !image->roi ? cvRect(0,0,image->width,image->height) :
1444  cvRect(image->roi->xOffset,image->roi->yOffset,
1445  image->roi->width,image->roi->height);
1446  }
1447 
1448  int coi() const { return !image || !image->roi ? 0 : image->roi->coi; }
1449 
1450  void set_roi(CvRect _roi) { cvSetImageROI(image,_roi); }
1451  void reset_roi() { cvResetImageROI(image); }
1452  void set_coi(int _coi) { cvSetImageCOI(image,_coi); }
1453  int depth() const { return image ? image->depth : 0; }
1454  int channels() const { return image ? image->nChannels : 0; }
1455  int pix_size() const { return image ? ((image->depth & 255)>>3)*image->nChannels : 0; }
1456 
1457  uchar* data() { return image ? (uchar*)image->imageData : 0; }
1458  const uchar* data() const { return image ? (const uchar*)image->imageData : 0; }
1459  int step() const { return image ? image->widthStep : 0; }
1460  int origin() const { return image ? image->origin : 0; }
1461 
1463  {
1464  assert(0<=y);
1465  assert(!image ?
1466  1 : image->roi ?
1467  y<image->roi->height : y<image->height);
1468 
1469  return !image ? 0 :
1470  !image->roi ?
1471  (uchar*)(image->imageData + y*image->widthStep) :
1472  (uchar*)(image->imageData + (y+image->roi->yOffset)*image->widthStep +
1473  image->roi->xOffset*((image->depth & 255)>>3)*image->nChannels);
1474  }
1475 
1476  const uchar* roi_row(int y) const
1477  {
1478  assert(0<=y);
1479  assert(!image ?
1480  1 : image->roi ?
1481  y<image->roi->height : y<image->height);
1482 
1483  return !image ? 0 :
1484  !image->roi ?
1485  (const uchar*)(image->imageData + y*image->widthStep) :
1486  (const uchar*)(image->imageData + (y+image->roi->yOffset)*image->widthStep +
1487  image->roi->xOffset*((image->depth & 255)>>3)*image->nChannels);
1488  }
1489 
1490  operator const IplImage* () const { return image; }
1491  operator IplImage* () { return image; }
1492 
1493  CvImage& operator = (const CvImage& img)
1494  {
1495  if( img.refcount )
1496  ++*img.refcount;
1497  if( refcount && !(--*refcount) )
1498  cvReleaseImage( &image );
1499  image=img.image;
1500  refcount=img.refcount;
1501  return *this;
1502  }
1503 
1504 protected:
1506  int* refcount;
1507 };
1508 
1509 
1510 class CV_EXPORTS CvMatrix
1511 {
1512 public:
1513  CvMatrix() : matrix(0) {}
1514  CvMatrix( int _rows, int _cols, int _type )
1515  { matrix = cvCreateMat( _rows, _cols, _type ); }
1516 
1517  CvMatrix( int _rows, int _cols, int _type, CvMat* hdr,
1518  void* _data=0, int _step=CV_AUTOSTEP )
1519  { matrix = cvInitMatHeader( hdr, _rows, _cols, _type, _data, _step ); }
1520 
1521  CvMatrix( int rows, int cols, int type, CvMemStorage* storage, bool alloc_data=true );
1522 
1523  CvMatrix( int _rows, int _cols, int _type, void* _data, int _step=CV_AUTOSTEP )
1524  { matrix = cvCreateMatHeader( _rows, _cols, _type );
1525  cvSetData( matrix, _data, _step ); }
1526 
1528  { matrix = m; }
1529 
1530  CvMatrix( const CvMatrix& m )
1531  {
1532  matrix = m.matrix;
1533  addref();
1534  }
1535 
1536  CvMatrix( const char* filename, const char* matname=0, int color=-1 ) : matrix(0)
1537  { load( filename, matname, color ); }
1538 
1539  CvMatrix( CvFileStorage* fs, const char* mapname, const char* matname ) : matrix(0)
1540  { read( fs, mapname, matname ); }
1541 
1542  CvMatrix( CvFileStorage* fs, const char* seqname, int idx ) : matrix(0)
1543  { read( fs, seqname, idx ); }
1544 
1546  {
1547  release();
1548  }
1549 
1550  CvMatrix clone() { return CvMatrix(matrix ? cvCloneMat(matrix) : 0); }
1551 
1552  void set( CvMat* m, bool add_ref )
1553  {
1554  release();
1555  matrix = m;
1556  if( add_ref )
1557  addref();
1558  }
1559 
1560  void create( int _rows, int _cols, int _type )
1561  {
1562  if( !matrix || !matrix->refcount ||
1563  matrix->rows != _rows || matrix->cols != _cols ||
1564  CV_MAT_TYPE(matrix->type) != _type )
1565  set( cvCreateMat( _rows, _cols, _type ), false );
1566  }
1567 
1568  void addref() const
1569  {
1570  if( matrix )
1571  {
1572  if( matrix->hdr_refcount )
1573  ++matrix->hdr_refcount;
1574  else if( matrix->refcount )
1575  ++*matrix->refcount;
1576  }
1577  }
1578 
1579  void release()
1580  {
1581  if( matrix )
1582  {
1583  if( matrix->hdr_refcount )
1584  {
1585  if( --matrix->hdr_refcount == 0 )
1586  cvReleaseMat( &matrix );
1587  }
1588  else if( matrix->refcount )
1589  {
1590  if( --*matrix->refcount == 0 )
1591  cvFree( &matrix->refcount );
1592  }
1593  matrix = 0;
1594  }
1595  }
1596 
1597  void clear()
1598  {
1599  release();
1600  }
1601 
1602  bool load( const char* filename, const char* matname=0, int color=-1 );
1603  bool read( CvFileStorage* fs, const char* mapname, const char* matname );
1604  bool read( CvFileStorage* fs, const char* seqname, int idx );
1605  void save( const char* filename, const char* matname, const int* params=0 );
1606  void write( CvFileStorage* fs, const char* matname );
1607 
1608  void show( const char* window_name );
1609 
1610  bool is_valid() { return matrix != 0; }
1611 
1612  int rows() const { return matrix ? matrix->rows : 0; }
1613  int cols() const { return matrix ? matrix->cols : 0; }
1614 
1615  CvSize size() const
1616  {
1617  return !matrix ? cvSize(0,0) : cvSize(matrix->rows,matrix->cols);
1618  }
1619 
1620  int type() const { return matrix ? CV_MAT_TYPE(matrix->type) : 0; }
1621  int depth() const { return matrix ? CV_MAT_DEPTH(matrix->type) : 0; }
1622  int channels() const { return matrix ? CV_MAT_CN(matrix->type) : 0; }
1623  int pix_size() const { return matrix ? CV_ELEM_SIZE(matrix->type) : 0; }
1624 
1625  uchar* data() { return matrix ? matrix->data.ptr : 0; }
1626  const uchar* data() const { return matrix ? matrix->data.ptr : 0; }
1627  int step() const { return matrix ? matrix->step : 0; }
1628 
1629  void set_data( void* _data, int _step=CV_AUTOSTEP )
1630  { cvSetData( matrix, _data, _step ); }
1631 
1632  uchar* row(int i) { return !matrix ? 0 : matrix->data.ptr + i*matrix->step; }
1633  const uchar* row(int i) const
1634  { return !matrix ? 0 : matrix->data.ptr + i*matrix->step; }
1635 
1636  operator const CvMat* () const { return matrix; }
1637  operator CvMat* () { return matrix; }
1638 
1639  CvMatrix& operator = (const CvMatrix& _m)
1640  {
1641  _m.addref();
1642  release();
1643  matrix = _m.matrix;
1644  return *this;
1645  }
1646 
1647 protected:
1649 };
1650 
1651 /****************************************************************************************\
1652  * CamShiftTracker *
1653  \****************************************************************************************/
1654 
1655 class CV_EXPORTS CvCamShiftTracker
1656 {
1657 public:
1658 
1660  virtual ~CvCamShiftTracker();
1661 
1662  /**** Characteristics of the object that are calculated by track_object method *****/
1663  float get_orientation() const // orientation of the object in degrees
1664  { return m_box.angle; }
1665  float get_length() const // the larger linear size of the object
1666  { return m_box.size.height; }
1667  float get_width() const // the smaller linear size of the object
1668  { return m_box.size.width; }
1669  CvPoint2D32f get_center() const // center of the object
1670  { return m_box.center; }
1671  CvRect get_window() const // bounding rectangle for the object
1672  { return m_comp.rect; }
1673 
1674  /*********************** Tracking parameters ************************/
1675  int get_threshold() const // thresholding value that applied to back project
1676  { return m_threshold; }
1677 
1678  int get_hist_dims( int* dims = 0 ) const // returns number of histogram dimensions and sets
1679  { return m_hist ? cvGetDims( m_hist->bins, dims ) : 0; }
1680 
1681  int get_min_ch_val( int channel ) const // get the minimum allowed value of the specified channel
1682  { return m_min_ch_val[channel]; }
1683 
1684  int get_max_ch_val( int channel ) const // get the maximum allowed value of the specified channel
1685  { return m_max_ch_val[channel]; }
1686 
1687  // set initial object rectangle (must be called before initial calculation of the histogram)
1689  { m_comp.rect = window; return true; }
1690 
1691  bool set_threshold( int threshold ) // threshold applied to the histogram bins
1692  { m_threshold = threshold; return true; }
1693 
1694  bool set_hist_bin_range( int dim, int min_val, int max_val );
1695 
1696  bool set_hist_dims( int c_dims, int* dims );// set the histogram parameters
1697 
1698  bool set_min_ch_val( int channel, int val ) // set the minimum allowed value of the specified channel
1699  { m_min_ch_val[channel] = val; return true; }
1700  bool set_max_ch_val( int channel, int val ) // set the maximum allowed value of the specified channel
1701  { m_max_ch_val[channel] = val; return true; }
1702 
1703  /************************ The processing methods *********************************/
1704  // update object position
1705  virtual bool track_object( const IplImage* cur_frame );
1706 
1707  // update object histogram
1708  virtual bool update_histogram( const IplImage* cur_frame );
1709 
1710  // reset histogram
1711  virtual void reset_histogram();
1712 
1713  /************************ Retrieving internal data *******************************/
1714  // get back project image
1716  { return m_back_project; }
1717 
1718  float query( int* bin ) const
1719  { return m_hist ? (float)cvGetRealND(m_hist->bins, bin) : 0.f; }
1720 
1721 protected:
1722 
1723  // internal method for color conversion: fills m_color_planes group
1724  virtual void color_transform( const IplImage* img );
1725 
1727 
1730 
1731  float m_hist_ranges_data[CV_MAX_DIM][2];
1732  float* m_hist_ranges[CV_MAX_DIM];
1733 
1734  int m_min_ch_val[CV_MAX_DIM];
1735  int m_max_ch_val[CV_MAX_DIM];
1737 
1738  IplImage* m_color_planes[CV_MAX_DIM];
1742 };
1743 
1744 /****************************************************************************************\
1745 * Expectation - Maximization *
1746 \****************************************************************************************/
1747 struct CV_EXPORTS_W_MAP CvEMParams
1748 {
1749  CvEMParams();
1750  CvEMParams( int nclusters, int cov_mat_type=cv::EM::COV_MAT_DIAGONAL,
1751  int start_step=cv::EM::START_AUTO_STEP,
1752  CvTermCriteria term_crit=cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 100, FLT_EPSILON),
1753  const CvMat* probs=0, const CvMat* weights=0, const CvMat* means=0, const CvMat** covs=0 );
1754 
1755  CV_PROP_RW int nclusters;
1756  CV_PROP_RW int cov_mat_type;
1757  CV_PROP_RW int start_step;
1758  const CvMat* probs;
1759  const CvMat* weights;
1760  const CvMat* means;
1761  const CvMat** covs;
1763 };
1764 
1765 
1766 class CV_EXPORTS_W CvEM : public CvStatModel
1767 {
1768 public:
1769  // Type of covariation matrices
1770  enum { COV_MAT_SPHERICAL=cv::EM::COV_MAT_SPHERICAL,
1771  COV_MAT_DIAGONAL =cv::EM::COV_MAT_DIAGONAL,
1772  COV_MAT_GENERIC =cv::EM::COV_MAT_GENERIC };
1773 
1774  // The initial step
1775  enum { START_E_STEP=cv::EM::START_E_STEP,
1776  START_M_STEP=cv::EM::START_M_STEP,
1777  START_AUTO_STEP=cv::EM::START_AUTO_STEP };
1778 
1779  CV_WRAP CvEM();
1780  CvEM( const CvMat* samples, const CvMat* sampleIdx=0,
1782 
1783  virtual ~CvEM();
1784 
1785  virtual bool train( const CvMat* samples, const CvMat* sampleIdx=0,
1787 
1788  virtual float predict( const CvMat* sample, CV_OUT CvMat* probs ) const;
1789 
1790  CV_WRAP CvEM( const cv::Mat& samples, const cv::Mat& sampleIdx=cv::Mat(),
1792 
1793  CV_WRAP virtual bool train( const cv::Mat& samples,
1794  const cv::Mat& sampleIdx=cv::Mat(),
1796  CV_OUT cv::Mat* labels=0 );
1797 
1798  CV_WRAP virtual float predict( const cv::Mat& sample, CV_OUT cv::Mat* probs=0 ) const;
1799  CV_WRAP virtual double calcLikelihood( const cv::Mat &sample ) const;
1800 
1801  CV_WRAP int getNClusters() const;
1802  CV_WRAP cv::Mat getMeans() const;
1803  CV_WRAP void getCovs(CV_OUT std::vector<cv::Mat>& covs) const;
1804  CV_WRAP cv::Mat getWeights() const;
1805  CV_WRAP cv::Mat getProbs() const;
1806 
1807  CV_WRAP inline double getLikelihood() const { return emObj.isTrained() ? logLikelihood : DBL_MAX; }
1808 
1809  CV_WRAP virtual void clear();
1810 
1811  int get_nclusters() const;
1812  const CvMat* get_means() const;
1813  const CvMat** get_covs() const;
1814  const CvMat* get_weights() const;
1815  const CvMat* get_probs() const;
1816 
1817  inline double get_log_likelihood() const { return getLikelihood(); }
1818 
1819  virtual void read( CvFileStorage* fs, CvFileNode* node );
1820  virtual void write( CvFileStorage* fs, const char* name ) const;
1821 
1822 protected:
1823  void set_mat_hdrs();
1824 
1828 
1830  std::vector<CvMat> covsHdrs;
1831  std::vector<CvMat*> covsPtrs;
1834 };
1835 
1836 namespace cv
1837 {
1838 
1841 
1845 class CV_EXPORTS PatchGenerator
1846 {
1847 public:
1848  PatchGenerator();
1849  PatchGenerator(double _backgroundMin, double _backgroundMax,
1850  double _noiseRange, bool _randomBlur=true,
1851  double _lambdaMin=0.6, double _lambdaMax=1.5,
1852  double _thetaMin=-CV_PI, double _thetaMax=CV_PI,
1853  double _phiMin=-CV_PI, double _phiMax=CV_PI );
1854  void operator()(const Mat& image, Point2f pt, Mat& patch, Size patchSize, RNG& rng) const;
1855  void operator()(const Mat& image, const Mat& transform, Mat& patch,
1856  Size patchSize, RNG& rng) const;
1857  void warpWholeImage(const Mat& image, Mat& matT, Mat& buf,
1858  CV_OUT Mat& warped, int border, RNG& rng) const;
1859  void generateRandomTransform(Point2f srcCenter, Point2f dstCenter,
1860  CV_OUT Mat& transform, RNG& rng,
1861  bool inverse=false) const;
1862  void setAffineParam(double lambda, double theta, double phi);
1863 
1864  double backgroundMin, backgroundMax;
1865  double noiseRange;
1867  double lambdaMin, lambdaMax;
1868  double thetaMin, thetaMax;
1869  double phiMin, phiMax;
1870 };
1871 
1872 
1873 class CV_EXPORTS LDetector
1874 {
1875 public:
1876  LDetector();
1877  LDetector(int _radius, int _threshold, int _nOctaves,
1878  int _nViews, double _baseFeatureSize, double _clusteringDistance);
1879  void operator()(const Mat& image,
1880  CV_OUT vector<KeyPoint>& keypoints,
1881  int maxCount=0, bool scaleCoords=true) const;
1882  void operator()(const vector<Mat>& pyr,
1883  CV_OUT vector<KeyPoint>& keypoints,
1884  int maxCount=0, bool scaleCoords=true) const;
1885  void getMostStable2D(const Mat& image, CV_OUT vector<KeyPoint>& keypoints,
1886  int maxCount, const PatchGenerator& patchGenerator) const;
1887  void setVerbose(bool verbose);
1888 
1889  void read(const FileNode& node);
1890  void write(FileStorage& fs, const String& name=String()) const;
1891 
1892  int radius;
1895  int nViews;
1896  bool verbose;
1897 
1900 };
1901 
1902 typedef LDetector YAPE;
1903 
1904 class CV_EXPORTS FernClassifier
1905 {
1906 public:
1907  FernClassifier();
1908  FernClassifier(const FileNode& node);
1909  FernClassifier(const vector<vector<Point2f> >& points,
1910  const vector<Mat>& refimgs,
1911  const vector<vector<int> >& labels=vector<vector<int> >(),
1912  int _nclasses=0, int _patchSize=PATCH_SIZE,
1913  int _signatureSize=DEFAULT_SIGNATURE_SIZE,
1914  int _nstructs=DEFAULT_STRUCTS,
1915  int _structSize=DEFAULT_STRUCT_SIZE,
1916  int _nviews=DEFAULT_VIEWS,
1917  int _compressionMethod=COMPRESSION_NONE,
1918  const PatchGenerator& patchGenerator=PatchGenerator());
1919  virtual ~FernClassifier();
1920  virtual void read(const FileNode& n);
1921  virtual void write(FileStorage& fs, const String& name=String()) const;
1922  virtual void trainFromSingleView(const Mat& image,
1923  const vector<KeyPoint>& keypoints,
1924  int _patchSize=PATCH_SIZE,
1925  int _signatureSize=DEFAULT_SIGNATURE_SIZE,
1926  int _nstructs=DEFAULT_STRUCTS,
1927  int _structSize=DEFAULT_STRUCT_SIZE,
1928  int _nviews=DEFAULT_VIEWS,
1929  int _compressionMethod=COMPRESSION_NONE,
1930  const PatchGenerator& patchGenerator=PatchGenerator());
1931  virtual void train(const vector<vector<Point2f> >& points,
1932  const vector<Mat>& refimgs,
1933  const vector<vector<int> >& labels=vector<vector<int> >(),
1934  int _nclasses=0, int _patchSize=PATCH_SIZE,
1935  int _signatureSize=DEFAULT_SIGNATURE_SIZE,
1936  int _nstructs=DEFAULT_STRUCTS,
1937  int _structSize=DEFAULT_STRUCT_SIZE,
1938  int _nviews=DEFAULT_VIEWS,
1939  int _compressionMethod=COMPRESSION_NONE,
1940  const PatchGenerator& patchGenerator=PatchGenerator());
1941  virtual int operator()(const Mat& img, Point2f kpt, vector<float>& signature) const;
1942  virtual int operator()(const Mat& patch, vector<float>& signature) const;
1943  virtual void clear();
1944  virtual bool empty() const;
1945  void setVerbose(bool verbose);
1946 
1947  int getClassCount() const;
1948  int getStructCount() const;
1949  int getStructSize() const;
1950  int getSignatureSize() const;
1951  int getCompressionMethod() const;
1952  Size getPatchSize() const;
1953 
1954  struct Feature
1955  {
1956  uchar x1, y1, x2, y2;
1957  Feature() : x1(0), y1(0), x2(0), y2(0) {}
1958  Feature(int _x1, int _y1, int _x2, int _y2)
1959  : x1((uchar)_x1), y1((uchar)_y1), x2((uchar)_x2), y2((uchar)_y2)
1960  {}
1961  template<typename _Tp> bool operator ()(const Mat_<_Tp>& patch) const
1962  { return patch(y1,x1) > patch(y2, x2); }
1963  };
1964 
1965  enum
1966  {
1967  PATCH_SIZE = 31,
1968  DEFAULT_STRUCTS = 50,
1969  DEFAULT_STRUCT_SIZE = 9,
1970  DEFAULT_VIEWS = 5000,
1971  DEFAULT_SIGNATURE_SIZE = 176,
1972  COMPRESSION_NONE = 0,
1973  COMPRESSION_RANDOM_PROJ = 1,
1974  COMPRESSION_PCA = 2,
1975  DEFAULT_COMPRESSION_METHOD = COMPRESSION_NONE
1976  };
1977 
1978 protected:
1979  virtual void prepare(int _nclasses, int _patchSize, int _signatureSize,
1980  int _nstructs, int _structSize,
1981  int _nviews, int _compressionMethod);
1982  virtual void finalize(RNG& rng);
1983  virtual int getLeaf(int fidx, const Mat& patch) const;
1984 
1985  bool verbose;
1993  vector<Feature> features;
1994  vector<int> classCounters;
1995  vector<float> posteriors;
1996 };
1997 
1998 
1999 /****************************************************************************************\
2000  * Calonder Classifier *
2001  \****************************************************************************************/
2002 
2003 struct RTreeNode;
2004 
2005 struct CV_EXPORTS BaseKeypoint
2006 {
2007  int x;
2008  int y;
2010 
2012  : x(0), y(0), image(NULL)
2013  {}
2014 
2015  BaseKeypoint(int _x, int _y, IplImage* _image)
2016  : x(_x), y(_y), image(_image)
2017  {}
2018 };
2019 
2020 class CV_EXPORTS RandomizedTree
2021 {
2022 public:
2023  friend class RTreeClassifier;
2024 
2025  static const uchar PATCH_SIZE = 32;
2026  static const int DEFAULT_DEPTH = 9;
2027  static const int DEFAULT_VIEWS = 5000;
2028  static const size_t DEFAULT_REDUCED_NUM_DIM = 176;
2029  static float GET_LOWER_QUANT_PERC() { return .03f; }
2030  static float GET_UPPER_QUANT_PERC() { return .92f; }
2031 
2032  RandomizedTree();
2033  ~RandomizedTree();
2034 
2035  void train(vector<BaseKeypoint> const& base_set, RNG &rng,
2036  int depth, int views, size_t reduced_num_dim, int num_quant_bits);
2037  void train(vector<BaseKeypoint> const& base_set, RNG &rng,
2038  PatchGenerator &make_patch, int depth, int views, size_t reduced_num_dim,
2039  int num_quant_bits);
2040 
2041  // following two funcs are EXPERIMENTAL (do not use unless you know exactly what you do)
2042  static void quantizeVector(float *vec, int dim, int N, float bnds[2], int clamp_mode=0);
2043  static void quantizeVector(float *src, int dim, int N, float bnds[2], uchar *dst);
2044 
2045  // patch_data must be a 32x32 array (no row padding)
2046  float* getPosterior(uchar* patch_data);
2047  const float* getPosterior(uchar* patch_data) const;
2048  uchar* getPosterior2(uchar* patch_data);
2049  const uchar* getPosterior2(uchar* patch_data) const;
2050 
2051  void read(const char* file_name, int num_quant_bits);
2052  void read(std::istream &is, int num_quant_bits);
2053  void write(const char* file_name) const;
2054  void write(std::ostream &os) const;
2055 
2056  int classes() { return classes_; }
2057  int depth() { return depth_; }
2058 
2059  //void setKeepFloatPosteriors(bool b) { keep_float_posteriors_ = b; }
2060  void discardFloatPosteriors() { freePosteriors(1); }
2061 
2062  inline void applyQuantization(int num_quant_bits) { makePosteriors2(num_quant_bits); }
2063 
2064  // debug
2065  void savePosteriors(std::string url, bool append=false);
2066  void savePosteriors2(std::string url, bool append=false);
2067 
2068 private:
2069  int classes_;
2070  int depth_;
2071  int num_leaves_;
2072  vector<RTreeNode> nodes_;
2073  float **posteriors_; // 16-bytes aligned posteriors
2074  uchar **posteriors2_; // 16-bytes aligned posteriors
2075  vector<int> leaf_counts_;
2076 
2077  void createNodes(int num_nodes, RNG &rng);
2078  void allocPosteriorsAligned(int num_leaves, int num_classes);
2079  void freePosteriors(int which); // which: 1=posteriors_, 2=posteriors2_, 3=both
2080  void init(int classes, int depth, RNG &rng);
2081  void addExample(int class_id, uchar* patch_data);
2082  void finalize(size_t reduced_num_dim, int num_quant_bits);
2083  int getIndex(uchar* patch_data) const;
2084  inline float* getPosteriorByIndex(int index);
2085  inline const float* getPosteriorByIndex(int index) const;
2086  inline uchar* getPosteriorByIndex2(int index);
2087  inline const uchar* getPosteriorByIndex2(int index) const;
2088  //void makeRandomMeasMatrix(float *cs_phi, PHI_DISTR_TYPE dt, size_t reduced_num_dim);
2089  void convertPosteriorsToChar();
2090  void makePosteriors2(int num_quant_bits);
2091  void compressLeaves(size_t reduced_num_dim);
2092  void estimateQuantPercForPosteriors(float perc[2]);
2093 };
2094 
2095 
2096 inline uchar* getData(IplImage* image)
2097 {
2098  return reinterpret_cast<uchar*>(image->imageData);
2099 }
2100 
2101 inline float* RandomizedTree::getPosteriorByIndex(int index)
2102 {
2103  return const_cast<float*>(const_cast<const RandomizedTree*>(this)->getPosteriorByIndex(index));
2104 }
2105 
2106 inline const float* RandomizedTree::getPosteriorByIndex(int index) const
2107 {
2108  return posteriors_[index];
2109 }
2110 
2111 inline uchar* RandomizedTree::getPosteriorByIndex2(int index)
2112 {
2113  return const_cast<uchar*>(const_cast<const RandomizedTree*>(this)->getPosteriorByIndex2(index));
2114 }
2115 
2116 inline const uchar* RandomizedTree::getPosteriorByIndex2(int index) const
2117 {
2118  return posteriors2_[index];
2119 }
2120 
2121 struct CV_EXPORTS RTreeNode
2122 {
2123  short offset1, offset2;
2124 
2126  RTreeNode(uchar x1, uchar y1, uchar x2, uchar y2)
2127  : offset1(y1*RandomizedTree::PATCH_SIZE + x1),
2128  offset2(y2*RandomizedTree::PATCH_SIZE + x2)
2129  {}
2130 
2132  inline bool operator() (uchar* patch_data) const
2133  {
2134  return patch_data[offset1] > patch_data[offset2];
2135  }
2136 };
2137 
2138 class CV_EXPORTS RTreeClassifier
2139 {
2140 public:
2141  static const int DEFAULT_TREES = 48;
2142  static const size_t DEFAULT_NUM_QUANT_BITS = 4;
2143 
2144  RTreeClassifier();
2145  void train(vector<BaseKeypoint> const& base_set,
2146  RNG &rng,
2147  int num_trees = RTreeClassifier::DEFAULT_TREES,
2149  int views = RandomizedTree::DEFAULT_VIEWS,
2150  size_t reduced_num_dim = RandomizedTree::DEFAULT_REDUCED_NUM_DIM,
2151  int num_quant_bits = DEFAULT_NUM_QUANT_BITS);
2152  void train(vector<BaseKeypoint> const& base_set,
2153  RNG &rng,
2154  PatchGenerator &make_patch,
2155  int num_trees = RTreeClassifier::DEFAULT_TREES,
2157  int views = RandomizedTree::DEFAULT_VIEWS,
2158  size_t reduced_num_dim = RandomizedTree::DEFAULT_REDUCED_NUM_DIM,
2159  int num_quant_bits = DEFAULT_NUM_QUANT_BITS);
2160 
2161  // sig must point to a memory block of at least classes()*sizeof(float|uchar) bytes
2162  void getSignature(IplImage *patch, uchar *sig) const;
2163  void getSignature(IplImage *patch, float *sig) const;
2164  void getSparseSignature(IplImage *patch, float *sig, float thresh) const;
2165  // TODO: deprecated in favor of getSignature overload, remove
2166  void getFloatSignature(IplImage *patch, float *sig) const { getSignature(patch, sig); }
2167 
2168  static int countNonZeroElements(float *vec, int n, double tol=1e-10);
2169  static inline void safeSignatureAlloc(uchar **sig, int num_sig=1, int sig_len=176);
2170  static inline uchar* safeSignatureAlloc(int num_sig=1, int sig_len=176);
2171 
2172  inline int classes() const { return classes_; }
2173  inline int original_num_classes() const { return original_num_classes_; }
2174 
2175  void setQuantization(int num_quant_bits);
2176  void discardFloatPosteriors();
2177 
2178  void read(const char* file_name);
2179  void read(std::istream &is);
2180  void write(const char* file_name) const;
2181  void write(std::ostream &os) const;
2182 
2183  // experimental and debug
2184  void saveAllFloatPosteriors(std::string file_url);
2185  void saveAllBytePosteriors(std::string file_url);
2186  void setFloatPosteriorsFromTextfile_176(std::string url);
2187  float countZeroElements();
2188 
2189  vector<RandomizedTree> trees_;
2190 
2191 private:
2192  int classes_;
2193  int num_quant_bits_;
2194  mutable uchar **posteriors_;
2195  mutable unsigned short *ptemp_;
2196  int original_num_classes_;
2197  bool keep_floats_;
2198 };
2199 
2200 /****************************************************************************************\
2201 * One-Way Descriptor *
2202 \****************************************************************************************/
2203 
2204 // CvAffinePose: defines a parameterized affine transformation of an image patch.
2205 // An image patch is rotated on angle phi (in degrees), then scaled lambda1 times
2206 // along horizontal and lambda2 times along vertical direction, and then rotated again
2207 // on angle (theta - phi).
2208 class CV_EXPORTS CvAffinePose
2209 {
2210 public:
2211  float phi;
2212  float theta;
2213  float lambda1;
2214  float lambda2;
2215 };
2216 
2217 class CV_EXPORTS OneWayDescriptor
2218 {
2219 public:
2220  OneWayDescriptor();
2221  ~OneWayDescriptor();
2222 
2223  // allocates memory for given descriptor parameters
2224  void Allocate(int pose_count, CvSize size, int nChannels);
2225 
2226  // GenerateSamples: generates affine transformed patches with averaging them over small transformation variations.
2227  // If external poses and transforms were specified, uses them instead of generating random ones
2228  // - pose_count: the number of poses to be generated
2229  // - frontal: the input patch (can be a roi in a larger image)
2230  // - norm: if nonzero, normalizes the output patch so that the sum of pixel intensities is 1
2231  void GenerateSamples(int pose_count, IplImage* frontal, int norm = 0);
2232 
2233  // GenerateSamplesFast: generates affine transformed patches with averaging them over small transformation variations.
2234  // Uses precalculated transformed pca components.
2235  // - frontal: the input patch (can be a roi in a larger image)
2236  // - pca_hr_avg: pca average vector
2237  // - pca_hr_eigenvectors: pca eigenvectors
2238  // - pca_descriptors: an array of precomputed descriptors of pca components containing their affine transformations
2239  // pca_descriptors[0] corresponds to the average, pca_descriptors[1]-pca_descriptors[pca_dim] correspond to eigenvectors
2240  void GenerateSamplesFast(IplImage* frontal, CvMat* pca_hr_avg,
2241  CvMat* pca_hr_eigenvectors, OneWayDescriptor* pca_descriptors);
2242 
2243  // sets the poses and corresponding transforms
2244  void SetTransforms(CvAffinePose* poses, CvMat** transforms);
2245 
2246  // Initialize: builds a descriptor.
2247  // - pose_count: the number of poses to build. If poses were set externally, uses them rather than generating random ones
2248  // - frontal: input patch. Can be a roi in a larger image
2249  // - feature_name: the feature name to be associated with the descriptor
2250  // - norm: if 1, the affine transformed patches are normalized so that their sum is 1
2251  void Initialize(int pose_count, IplImage* frontal, const char* feature_name = 0, int norm = 0);
2252 
2253  // InitializeFast: builds a descriptor using precomputed descriptors of pca components
2254  // - pose_count: the number of poses to build
2255  // - frontal: input patch. Can be a roi in a larger image
2256  // - feature_name: the feature name to be associated with the descriptor
2257  // - pca_hr_avg: average vector for PCA
2258  // - pca_hr_eigenvectors: PCA eigenvectors (one vector per row)
2259  // - pca_descriptors: precomputed descriptors of PCA components, the first descriptor for the average vector
2260  // followed by the descriptors for eigenvectors
2261  void InitializeFast(int pose_count, IplImage* frontal, const char* feature_name,
2262  CvMat* pca_hr_avg, CvMat* pca_hr_eigenvectors, OneWayDescriptor* pca_descriptors);
2263 
2264  // ProjectPCASample: unwarps an image patch into a vector and projects it into PCA space
2265  // - patch: input image patch
2266  // - avg: PCA average vector
2267  // - eigenvectors: PCA eigenvectors, one per row
2268  // - pca_coeffs: output PCA coefficients
2269  void ProjectPCASample(IplImage* patch, CvMat* avg, CvMat* eigenvectors, CvMat* pca_coeffs) const;
2270 
2271  // InitializePCACoeffs: projects all warped patches into PCA space
2272  // - avg: PCA average vector
2273  // - eigenvectors: PCA eigenvectors, one per row
2274  void InitializePCACoeffs(CvMat* avg, CvMat* eigenvectors);
2275 
2276  // EstimatePose: finds the closest match between an input patch and a set of patches with different poses
2277  // - patch: input image patch
2278  // - pose_idx: the output index of the closest pose
2279  // - distance: the distance to the closest pose (L2 distance)
2280  void EstimatePose(IplImage* patch, int& pose_idx, float& distance) const;
2281 
2282  // EstimatePosePCA: finds the closest match between an input patch and a set of patches with different poses.
2283  // The distance between patches is computed in PCA space
2284  // - patch: input image patch
2285  // - pose_idx: the output index of the closest pose
2286  // - distance: distance to the closest pose (L2 distance in PCA space)
2287  // - avg: PCA average vector. If 0, matching without PCA is used
2288  // - eigenvectors: PCA eigenvectors, one per row
2289  void EstimatePosePCA(CvArr* patch, int& pose_idx, float& distance, CvMat* avg, CvMat* eigenvalues) const;
2290 
2291  // GetPatchSize: returns the size of each image patch after warping (2 times smaller than the input patch)
2293  {
2294  return m_patch_size;
2295  }
2296 
2297  // GetInputPatchSize: returns the required size of the patch that the descriptor is built from
2298  // (2 time larger than the patch after warping)
2300  {
2301  return cvSize(m_patch_size.width*2, m_patch_size.height*2);
2302  }
2303 
2304  // GetPatch: returns a patch corresponding to specified pose index
2305  // - index: pose index
2306  // - return value: the patch corresponding to specified pose index
2307  IplImage* GetPatch(int index);
2308 
2309  // GetPose: returns a pose corresponding to specified pose index
2310  // - index: pose index
2311  // - return value: the pose corresponding to specified pose index
2312  CvAffinePose GetPose(int index) const;
2313 
2314  // Save: saves all patches with different poses to a specified path
2315  void Save(const char* path);
2316 
2317  // ReadByName: reads a descriptor from a file storage
2318  // - fs: file storage
2319  // - parent: parent node
2320  // - name: node name
2321  // - return value: 1 if succeeded, 0 otherwise
2322  int ReadByName(CvFileStorage* fs, CvFileNode* parent, const char* name);
2323 
2324  // ReadByName: reads a descriptor from a file node
2325  // - parent: parent node
2326  // - name: node name
2327  // - return value: 1 if succeeded, 0 otherwise
2328  int ReadByName(const FileNode &parent, const char* name);
2329 
2330  // Write: writes a descriptor into a file storage
2331  // - fs: file storage
2332  // - name: node name
2333  void Write(CvFileStorage* fs, const char* name);
2334 
2335  // GetFeatureName: returns a name corresponding to a feature
2336  const char* GetFeatureName() const;
2337 
2338  // GetCenter: returns the center of the feature
2339  CvPoint GetCenter() const;
2340 
2341  void SetPCADimHigh(int pca_dim_high) {m_pca_dim_high = pca_dim_high;};
2342  void SetPCADimLow(int pca_dim_low) {m_pca_dim_low = pca_dim_low;};
2343 
2344  int GetPCADimLow() const;
2345  int GetPCADimHigh() const;
2346 
2347  CvMat** GetPCACoeffs() const {return m_pca_coeffs;}
2348 
2349 protected:
2350  int m_pose_count; // the number of poses
2351  CvSize m_patch_size; // size of each image
2352  IplImage** m_samples; // an array of length m_pose_count containing the patch in different poses
2355  CvMat** m_pca_coeffs; // an array of length m_pose_count containing pca decomposition of the patch in different poses
2356  CvAffinePose* m_affine_poses; // an array of poses
2357  CvMat** m_transforms; // an array of affine transforms corresponding to poses
2358 
2359  string m_feature_name; // the name of the feature associated with the descriptor
2360  CvPoint m_center; // the coordinates of the feature (the center of the input image ROI)
2361 
2362  int m_pca_dim_high; // the number of descriptor pca components to use for generating affine poses
2363  int m_pca_dim_low; // the number of pca components to use for comparison
2364 };
2365 
2366 
2367 // OneWayDescriptorBase: encapsulates functionality for training/loading a set of one way descriptors
2368 // and finding the nearest closest descriptor to an input feature
2369 class CV_EXPORTS OneWayDescriptorBase
2370 {
2371 public:
2372 
2373  // creates an instance of OneWayDescriptor from a set of training files
2374  // - patch_size: size of the input (large) patch
2375  // - pose_count: the number of poses to generate for each descriptor
2376  // - train_path: path to training files
2377  // - pca_config: the name of the file that contains PCA for small patches (2 times smaller
2378  // than patch_size each dimension
2379  // - pca_hr_config: the name of the file that contains PCA for large patches (of patch_size size)
2380  // - pca_desc_config: the name of the file that contains descriptors of PCA components
2381  OneWayDescriptorBase(CvSize patch_size, int pose_count, const char* train_path = 0, const char* pca_config = 0,
2382  const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1,
2383  int pca_dim_high = 100, int pca_dim_low = 100);
2384 
2385  OneWayDescriptorBase(CvSize patch_size, int pose_count, const string &pca_filename, const string &train_path = string(), const string &images_list = string(),
2386  float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1,
2387  int pca_dim_high = 100, int pca_dim_low = 100);
2388 
2389 
2390  virtual ~OneWayDescriptorBase();
2391  void clear ();
2392 
2393 
2394  // Allocate: allocates memory for a given number of descriptors
2395  void Allocate(int train_feature_count);
2396 
2397  // AllocatePCADescriptors: allocates memory for pca descriptors
2398  void AllocatePCADescriptors();
2399 
2400  // returns patch size
2401  CvSize GetPatchSize() const {return m_patch_size;};
2402  // returns the number of poses for each descriptor
2403  int GetPoseCount() const {return m_pose_count;};
2404 
2405  // returns the number of pyramid levels
2406  int GetPyrLevels() const {return m_pyr_levels;};
2407 
2408  // returns the number of descriptors
2409  int GetDescriptorCount() const {return m_train_feature_count;};
2410 
2411  // CreateDescriptorsFromImage: creates descriptors for each of the input features
2412  // - src: input image
2413  // - features: input features
2414  // - pyr_levels: the number of pyramid levels
2415  void CreateDescriptorsFromImage(IplImage* src, const vector<KeyPoint>& features);
2416 
2417  // CreatePCADescriptors: generates descriptors for PCA components, needed for fast generation of feature descriptors
2418  void CreatePCADescriptors();
2419 
2420  // returns a feature descriptor by feature index
2421  const OneWayDescriptor* GetDescriptor(int desc_idx) const {return &m_descriptors[desc_idx];};
2422 
2423  // FindDescriptor: finds the closest descriptor
2424  // - patch: input image patch
2425  // - desc_idx: output index of the closest descriptor to the input patch
2426  // - pose_idx: output index of the closest pose of the closest descriptor to the input patch
2427  // - distance: distance from the input patch to the closest feature pose
2428  // - _scales: scales of the input patch for each descriptor
2429  // - scale_ranges: input scales variation (float[2])
2430  void FindDescriptor(IplImage* patch, int& desc_idx, int& pose_idx, float& distance, float* _scale = 0, float* scale_ranges = 0) const;
2431 
2432  // - patch: input image patch
2433  // - n: number of the closest indexes
2434  // - desc_idxs: output indexes of the closest descriptor to the input patch (n)
2435  // - pose_idx: output indexes of the closest pose of the closest descriptor to the input patch (n)
2436  // - distances: distance from the input patch to the closest feature pose (n)
2437  // - _scales: scales of the input patch
2438  // - scale_ranges: input scales variation (float[2])
2439  void FindDescriptor(IplImage* patch, int n, vector<int>& desc_idxs, vector<int>& pose_idxs,
2440  vector<float>& distances, vector<float>& _scales, float* scale_ranges = 0) const;
2441 
2442  // FindDescriptor: finds the closest descriptor
2443  // - src: input image
2444  // - pt: center of the feature
2445  // - desc_idx: output index of the closest descriptor to the input patch
2446  // - pose_idx: output index of the closest pose of the closest descriptor to the input patch
2447  // - distance: distance from the input patch to the closest feature pose
2448  void FindDescriptor(IplImage* src, cv::Point2f pt, int& desc_idx, int& pose_idx, float& distance) const;
2449 
2450  // InitializePoses: generates random poses
2451  void InitializePoses();
2452 
2453  // InitializeTransformsFromPoses: generates 2x3 affine matrices from poses (initializes m_transforms)
2454  void InitializeTransformsFromPoses();
2455 
2456  // InitializePoseTransforms: subsequently calls InitializePoses and InitializeTransformsFromPoses
2457  void InitializePoseTransforms();
2458 
2459  // InitializeDescriptor: initializes a descriptor
2460  // - desc_idx: descriptor index
2461  // - train_image: image patch (ROI is supported)
2462  // - feature_label: feature textual label
2463  void InitializeDescriptor(int desc_idx, IplImage* train_image, const char* feature_label);
2464 
2465  void InitializeDescriptor(int desc_idx, IplImage* train_image, const KeyPoint& keypoint, const char* feature_label);
2466 
2467  // InitializeDescriptors: load features from an image and create descriptors for each of them
2468  void InitializeDescriptors(IplImage* train_image, const vector<KeyPoint>& features,
2469  const char* feature_label = "", int desc_start_idx = 0);
2470 
2471  // Write: writes this object to a file storage
2472  // - fs: output filestorage
2473  void Write (FileStorage &fs) const;
2474 
2475  // Read: reads OneWayDescriptorBase object from a file node
2476  // - fn: input file node
2477  void Read (const FileNode &fn);
2478 
2479  // LoadPCADescriptors: loads PCA descriptors from a file
2480  // - filename: input filename
2481  int LoadPCADescriptors(const char* filename);
2482 
2483  // LoadPCADescriptors: loads PCA descriptors from a file node
2484  // - fn: input file node
2485  int LoadPCADescriptors(const FileNode &fn);
2486 
2487  // SavePCADescriptors: saves PCA descriptors to a file
2488  // - filename: output filename
2489  void SavePCADescriptors(const char* filename);
2490 
2491  // SavePCADescriptors: saves PCA descriptors to a file storage
2492  // - fs: output file storage
2493  void SavePCADescriptors(CvFileStorage* fs) const;
2494 
2495  // GeneratePCA: calculate and save PCA components and descriptors
2496  // - img_path: path to training PCA images directory
2497  // - images_list: filename with filenames of training PCA images
2498  void GeneratePCA(const char* img_path, const char* images_list, int pose_count=500);
2499 
2500  // SetPCAHigh: sets the high resolution pca matrices (copied to internal structures)
2501  void SetPCAHigh(CvMat* avg, CvMat* eigenvectors);
2502 
2503  // SetPCALow: sets the low resolution pca matrices (copied to internal structures)
2504  void SetPCALow(CvMat* avg, CvMat* eigenvectors);
2505 
2506  int GetLowPCA(CvMat** avg, CvMat** eigenvectors)
2507  {
2508  *avg = m_pca_avg;
2509  *eigenvectors = m_pca_eigenvectors;
2510  return m_pca_dim_low;
2511  };
2512 
2513  int GetPCADimLow() const {return m_pca_dim_low;};
2514  int GetPCADimHigh() const {return m_pca_dim_high;};
2515 
2516  void ConvertDescriptorsArrayToTree(); // Converting pca_descriptors array to KD tree
2517 
2518  // GetPCAFilename: get default PCA filename
2519  static string GetPCAFilename () { return "pca.yml"; }
2520 
2521  virtual bool empty() const { return m_train_feature_count <= 0 ? true : false; }
2522 
2523 protected:
2524  CvSize m_patch_size; // patch size
2525  int m_pose_count; // the number of poses for each descriptor
2526  int m_train_feature_count; // the number of the training features
2527  OneWayDescriptor* m_descriptors; // array of train feature descriptors
2528  CvMat* m_pca_avg; // PCA average Vector for small patches
2529  CvMat* m_pca_eigenvectors; // PCA eigenvectors for small patches
2530  CvMat* m_pca_hr_avg; // PCA average Vector for large patches
2531  CvMat* m_pca_hr_eigenvectors; // PCA eigenvectors for large patches
2532  OneWayDescriptor* m_pca_descriptors; // an array of PCA descriptors
2533 
2536 
2537  CvAffinePose* m_poses; // array of poses
2538  CvMat** m_transforms; // array of affine transformations corresponding to poses
2539 
2542 
2544  float scale_min;
2545  float scale_max;
2546  float scale_step;
2547 
2548  // SavePCAall: saves PCA components and descriptors to a file storage
2549  // - fs: output file storage
2550  void SavePCAall (FileStorage &fs) const;
2551 
2552  // LoadPCAall: loads PCA components and descriptors from a file node
2553  // - fn: input file node
2554  void LoadPCAall (const FileNode &fn);
2555 };
2556 
2558 {
2559 public:
2560  // creates an instance of OneWayDescriptorObject from a set of training files
2561  // - patch_size: size of the input (large) patch
2562  // - pose_count: the number of poses to generate for each descriptor
2563  // - train_path: path to training files
2564  // - pca_config: the name of the file that contains PCA for small patches (2 times smaller
2565  // than patch_size each dimension
2566  // - pca_hr_config: the name of the file that contains PCA for large patches (of patch_size size)
2567  // - pca_desc_config: the name of the file that contains descriptors of PCA components
2568  OneWayDescriptorObject(CvSize patch_size, int pose_count, const char* train_path, const char* pca_config,
2569  const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1);
2570 
2571  OneWayDescriptorObject(CvSize patch_size, int pose_count, const string &pca_filename,
2572  const string &train_path = string (), const string &images_list = string (),
2573  float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1);
2574 
2575 
2576  virtual ~OneWayDescriptorObject();
2577 
2578  // Allocate: allocates memory for a given number of features
2579  // - train_feature_count: the total number of features
2580  // - object_feature_count: the number of features extracted from the object
2581  void Allocate(int train_feature_count, int object_feature_count);
2582 
2583 
2584  void SetLabeledFeatures(const vector<KeyPoint>& features) {m_train_features = features;};
2585  vector<KeyPoint>& GetLabeledFeatures() {return m_train_features;};
2586  const vector<KeyPoint>& GetLabeledFeatures() const {return m_train_features;};
2587  vector<KeyPoint> _GetLabeledFeatures() const;
2588 
2589  // IsDescriptorObject: returns 1 if descriptor with specified index is positive, otherwise 0
2590  int IsDescriptorObject(int desc_idx) const;
2591 
2592  // MatchPointToPart: returns the part number of a feature if it matches one of the object parts, otherwise -1
2593  int MatchPointToPart(CvPoint pt) const;
2594 
2595  // GetDescriptorPart: returns the part number of the feature corresponding to a specified descriptor
2596  // - desc_idx: descriptor index
2597  int GetDescriptorPart(int desc_idx) const;
2598 
2599 
2600  void InitializeObjectDescriptors(IplImage* train_image, const vector<KeyPoint>& features,
2601  const char* feature_label, int desc_start_idx = 0, float scale = 1.0f,
2602  int is_background = 0);
2603 
2604  // GetObjectFeatureCount: returns the number of object features
2605  int GetObjectFeatureCount() const {return m_object_feature_count;};
2606 
2607 protected:
2608  int* m_part_id; // contains part id for each of object descriptors
2609  vector<KeyPoint> m_train_features; // train features
2610  int m_object_feature_count; // the number of the positive features
2611 
2612 };
2613 
2614 
2615 /*
2616  * OneWayDescriptorMatcher
2617  */
2620 
2622 {
2623 public:
2624  class CV_EXPORTS Params
2625  {
2626  public:
2627  static const int POSE_COUNT = 500;
2628  static const int PATCH_WIDTH = 24;
2629  static const int PATCH_HEIGHT = 24;
2630  static float GET_MIN_SCALE() { return 0.7f; }
2631  static float GET_MAX_SCALE() { return 1.5f; }
2632  static float GET_STEP_SCALE() { return 1.2f; }
2633 
2634  Params( int poseCount = POSE_COUNT,
2635  Size patchSize = Size(PATCH_WIDTH, PATCH_HEIGHT),
2636  string pcaFilename = string(),
2637  string trainPath = string(), string trainImagesList = string(),
2638  float minScale = GET_MIN_SCALE(), float maxScale = GET_MAX_SCALE(),
2639  float stepScale = GET_STEP_SCALE() );
2640 
2643  string pcaFilename;
2644  string trainPath;
2646 
2647  float minScale, maxScale, stepScale;
2648  };
2649 
2651  virtual ~OneWayDescriptorMatcher();
2652 
2653  void initialize( const Params& params, const Ptr<OneWayDescriptorBase>& base=Ptr<OneWayDescriptorBase>() );
2654 
2655  // Clears keypoints storing in collection and OneWayDescriptorBase
2656  virtual void clear();
2657 
2658  virtual void train();
2659 
2660  virtual bool isMaskSupported();
2661 
2662  virtual void read( const FileNode &fn );
2663  virtual void write( FileStorage& fs ) const;
2664 
2665  virtual bool empty() const;
2666 
2667  virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;
2668 
2669 protected:
2670  // Matches a set of keypoints from a single image of the training set. A rectangle with a center in a keypoint
2671  // and size (patch_width/2*scale, patch_height/2*scale) is cropped from the source image for each
2672  // keypoint. scale is iterated from DescriptorOneWayParams::min_scale to DescriptorOneWayParams::max_scale.
2673  // The minimum distance to each training patch with all its affine poses is found over all scales.
2674  // The class ID of a match is returned for each keypoint. The distance is calculated over PCA components
2675  // loaded with DescriptorOneWay::Initialize, kd tree is used for finding minimum distances.
2676  virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
2677  vector<vector<DMatch> >& matches, int k,
2678  const vector<Mat>& masks, bool compactResult );
2679  virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
2680  vector<vector<DMatch> >& matches, float maxDistance,
2681  const vector<Mat>& masks, bool compactResult );
2682 
2686 };
2687 
2688 /*
2689  * FernDescriptorMatcher
2690  */
2693 
2695 {
2696 public:
2697  class CV_EXPORTS Params
2698  {
2699  public:
2700  Params( int nclasses=0,
2701  int patchSize=FernClassifier::PATCH_SIZE,
2702  int signatureSize=FernClassifier::DEFAULT_SIGNATURE_SIZE,
2703  int nstructs=FernClassifier::DEFAULT_STRUCTS,
2704  int structSize=FernClassifier::DEFAULT_STRUCT_SIZE,
2705  int nviews=FernClassifier::DEFAULT_VIEWS,
2706  int compressionMethod=FernClassifier::COMPRESSION_NONE,
2707  const PatchGenerator& patchGenerator=PatchGenerator() );
2708 
2709  Params( const string& filename );
2710 
2716  int nviews;
2719 
2720  string filename;
2721  };
2722 
2724  virtual ~FernDescriptorMatcher();
2725 
2726  virtual void clear();
2727 
2728  virtual void train();
2729 
2730  virtual bool isMaskSupported();
2731 
2732  virtual void read( const FileNode &fn );
2733  virtual void write( FileStorage& fs ) const;
2734  virtual bool empty() const;
2735 
2736  virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const;
2737 
2738 protected:
2739  virtual void knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
2740  vector<vector<DMatch> >& matches, int k,
2741  const vector<Mat>& masks, bool compactResult );
2742  virtual void radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
2743  vector<vector<DMatch> >& matches, float maxDistance,
2744  const vector<Mat>& masks, bool compactResult );
2745 
2746  void trainFernClassifier();
2747  void calcBestProbAndMatchIdx( const Mat& image, const Point2f& pt,
2748  float& bestProb, int& bestMatchIdx, vector<float>& signature );
2752 };
2753 
2754 
2755 /*
2756  * CalonderDescriptorExtractor
2757  */
2758 template<typename T>
2760 {
2761 public:
2762  CalonderDescriptorExtractor( const string& classifierFile );
2763 
2764  virtual void read( const FileNode &fn );
2765  virtual void write( FileStorage &fs ) const;
2766 
2767  virtual int descriptorSize() const { return classifier_.classes(); }
2768  virtual int descriptorType() const { return DataType<T>::type; }
2769 
2770  virtual bool empty() const;
2771 
2772 protected:
2773  virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
2774 
2776  static const int BORDER_SIZE = 16;
2777 };
2778 
2779 template<typename T>
2781 {
2782  classifier_.read( classifier_file.c_str() );
2783 }
2784 
2785 template<typename T>
2787  vector<KeyPoint>& keypoints,
2788  Mat& descriptors) const
2789 {
2790  // Cannot compute descriptors for keypoints on the image border.
2791  KeyPointsFilter::runByImageBorder(keypoints, image.size(), BORDER_SIZE);
2792 
2794  descriptors.create((int)keypoints.size(), classifier_.classes(), cv::DataType<T>::type);
2795 
2796  int patchSize = RandomizedTree::PATCH_SIZE;
2797  int offset = patchSize / 2;
2798  for (size_t i = 0; i < keypoints.size(); ++i)
2799  {
2800  cv::Point2f pt = keypoints[i].pt;
2801  IplImage ipl = image( Rect((int)(pt.x - offset), (int)(pt.y - offset), patchSize, patchSize) );
2802  classifier_.getSignature( &ipl, descriptors.ptr<T>((int)i));
2803  }
2804 }
2805 
2806 template<typename T>
2808 {}
2809 
2810 template<typename T>
2812 {}
2813 
2814 template<typename T>
2816 {
2817  return classifier_.trees_.empty();
2818 }
2819 
2820 
2822 
2823 template<class Distance>
2824 class CV_EXPORTS BruteForceMatcher : public BFMatcher
2825 {
2826 public:
2827  BruteForceMatcher( Distance d = Distance() ) : BFMatcher(Distance::normType, false) {(void)d;}
2828  virtual ~BruteForceMatcher() {}
2829 };
2830 
2831 
2832 /****************************************************************************************\
2833 * Planar Object Detection *
2834 \****************************************************************************************/
2835 
2836 class CV_EXPORTS PlanarObjectDetector
2837 {
2838 public:
2841  PlanarObjectDetector(const vector<Mat>& pyr, int _npoints=300,
2842  int _patchSize=FernClassifier::PATCH_SIZE,
2843  int _nstructs=FernClassifier::DEFAULT_STRUCTS,
2844  int _structSize=FernClassifier::DEFAULT_STRUCT_SIZE,
2845  int _nviews=FernClassifier::DEFAULT_VIEWS,
2846  const LDetector& detector=LDetector(),
2847  const PatchGenerator& patchGenerator=PatchGenerator());
2848  virtual ~PlanarObjectDetector();
2849  virtual void train(const vector<Mat>& pyr, int _npoints=300,
2850  int _patchSize=FernClassifier::PATCH_SIZE,
2851  int _nstructs=FernClassifier::DEFAULT_STRUCTS,
2852  int _structSize=FernClassifier::DEFAULT_STRUCT_SIZE,
2853  int _nviews=FernClassifier::DEFAULT_VIEWS,
2854  const LDetector& detector=LDetector(),
2855  const PatchGenerator& patchGenerator=PatchGenerator());
2856  virtual void train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
2857  int _patchSize=FernClassifier::PATCH_SIZE,
2858  int _nstructs=FernClassifier::DEFAULT_STRUCTS,
2859  int _structSize=FernClassifier::DEFAULT_STRUCT_SIZE,
2860  int _nviews=FernClassifier::DEFAULT_VIEWS,
2861  const LDetector& detector=LDetector(),
2862  const PatchGenerator& patchGenerator=PatchGenerator());
2863  Rect getModelROI() const;
2864  vector<KeyPoint> getModelPoints() const;
2865  const LDetector& getDetector() const;
2866  const FernClassifier& getClassifier() const;
2867  void setVerbose(bool verbose);
2868 
2869  void read(const FileNode& node);
2870  void write(FileStorage& fs, const String& name=String()) const;
2871  bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;
2872  bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
2873  CV_OUT Mat& H, CV_OUT vector<Point2f>& corners,
2874  CV_OUT vector<int>* pairs=0) const;
2875 
2876 protected:
2877  bool verbose;
2879  vector<KeyPoint> modelPoints;
2882 };
2883 
2884 }
2885 
2886 // 2009-01-12, Xavier Delacour <xavier.delacour@gmail.com>
2887 
2888 struct lsh_hash {
2889  int h1, h2;
2890 };
2891 
2893 {
2894  virtual ~CvLSHOperations() {}
2895 
2896  virtual int vector_add(const void* data) = 0;
2897  virtual void vector_remove(int i) = 0;
2898  virtual const void* vector_lookup(int i) = 0;
2899  virtual void vector_reserve(int n) = 0;
2900  virtual unsigned int vector_count() = 0;
2901 
2902  virtual void hash_insert(lsh_hash h, int l, int i) = 0;
2903  virtual void hash_remove(lsh_hash h, int l, int i) = 0;
2904  virtual int hash_lookup(lsh_hash h, int l, int* ret_i, int ret_i_max) = 0;
2905 };
2906 
2907 #endif
2908 
2909 #ifdef __cplusplus
2910 extern "C" {
2911 #endif
2912 
2913 /* Splits color or grayscale image into multiple connected components
2914  of nearly the same color/brightness using modification of Burt algorithm.
2915  comp with contain a pointer to sequence (CvSeq)
2916  of connected components (CvConnectedComp) */
2917 CVAPI(void) cvPyrSegmentation( IplImage* src, IplImage* dst,
2918  CvMemStorage* storage, CvSeq** comp,
2919  int level, double threshold1,
2920  double threshold2 );
2921 
2922 /****************************************************************************************\
2923 * Planar subdivisions *
2924 \****************************************************************************************/
2925 
2926 /* Initializes Delaunay triangulation */
2927 CVAPI(void) cvInitSubdivDelaunay2D( CvSubdiv2D* subdiv, CvRect rect );
2928 
2929 /* Creates new subdivision */
2930 CVAPI(CvSubdiv2D*) cvCreateSubdiv2D( int subdiv_type, int header_size,
2931  int vtx_size, int quadedge_size,
2932  CvMemStorage* storage );
2933 
2934 /************************* high-level subdivision functions ***************************/
2935 
2936 /* Simplified Delaunay diagram creation */
2938 {
2939  CvSubdiv2D* subdiv = cvCreateSubdiv2D( CV_SEQ_KIND_SUBDIV2D, sizeof(*subdiv),
2940  sizeof(CvSubdiv2DPoint), sizeof(CvQuadEdge2D), storage );
2941 
2942  cvInitSubdivDelaunay2D( subdiv, rect );
2943  return subdiv;
2944 }
2945 
2946 
2947 /* Inserts new point to the Delaunay triangulation */
2948 CVAPI(CvSubdiv2DPoint*) cvSubdivDelaunay2DInsert( CvSubdiv2D* subdiv, CvPoint2D32f pt);
2949 
2950 /* Locates a point within the Delaunay triangulation (finds the edge
2951  the point is left to or belongs to, or the triangulation point the given
2952  point coinsides with */
2953 CVAPI(CvSubdiv2DPointLocation) cvSubdiv2DLocate(
2956  CvSubdiv2DPoint** vertex CV_DEFAULT(NULL) );
2957 
2958 /* Calculates Voronoi tesselation (i.e. coordinates of Voronoi points) */
2959 CVAPI(void) cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv );
2960 
2961 
2962 /* Removes all Voronoi points from the tesselation */
2963 CVAPI(void) cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv );
2964 
2965 
2966 /* Finds the nearest to the given point vertex in subdivision. */
2967 CVAPI(CvSubdiv2DPoint*) cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt );
2968 
2969 
2970 /************ Basic quad-edge navigation and operations ************/
2971 
2973 {
2974  return CV_SUBDIV2D_NEXT_EDGE(edge);
2975 }
2976 
2977 
2979 {
2980  return (edge & ~3) + ((edge + rotate) & 3);
2981 }
2982 
2984 {
2985  return edge ^ 2;
2986 }
2987 
2989 {
2990  CvQuadEdge2D* e = (CvQuadEdge2D*)(edge & ~3);
2991  edge = e->next[(edge + (int)type) & 3];
2992  return (edge & ~3) + ((edge + ((int)type >> 4)) & 3);
2993 }
2994 
2995 
2997 {
2998  CvQuadEdge2D* e = (CvQuadEdge2D*)(edge & ~3);
2999  return (CvSubdiv2DPoint*)e->pt[edge & 3];
3000 }
3001 
3002 
3004 {
3005  CvQuadEdge2D* e = (CvQuadEdge2D*)(edge & ~3);
3006  return (CvSubdiv2DPoint*)e->pt[(edge + 2) & 3];
3007 }
3008 
3009 /****************************************************************************************\
3010 * Additional operations on Subdivisions *
3011 \****************************************************************************************/
3012 
3013 // paints voronoi diagram: just demo function
3014 CVAPI(void) icvDrawMosaic( CvSubdiv2D* subdiv, IplImage* src, IplImage* dst );
3015 
3016 // checks planar subdivision for correctness. It is not an absolute check,
3017 // but it verifies some relations between quad-edges
3018 CVAPI(int) icvSubdiv2DCheck( CvSubdiv2D* subdiv );
3019 
3020 // returns squared distance between two 2D points with floating-point coordinates.
3022 {
3023  double dx = pt1.x - pt2.x;
3024  double dy = pt1.y - pt2.y;
3025 
3026  return dx*dx + dy*dy;
3027 }
3028 
3029 
3030 
3031 
3033 {
3034  return ((double)b.x - a.x) * ((double)c.y - a.y) - ((double)b.y - a.y) * ((double)c.x - a.x);
3035 }
3036 
3037 
3038 /* Constructs kd-tree from set of feature descriptors */
3039 CVAPI(struct CvFeatureTree*) cvCreateKDTree(CvMat* desc);
3040 
3041 /* Constructs spill-tree from set of feature descriptors */
3042 CVAPI(struct CvFeatureTree*) cvCreateSpillTree( const CvMat* raw_data,
3043  const int naive CV_DEFAULT(50),
3044  const double rho CV_DEFAULT(.7),
3045  const double tau CV_DEFAULT(.1) );
3046 
3047 /* Release feature tree */
3048 CVAPI(void) cvReleaseFeatureTree(struct CvFeatureTree* tr);
3049 
3050 /* Searches feature tree for k nearest neighbors of given reference points,
3051  searching (in case of kd-tree/bbf) at most emax leaves. */
3052 CVAPI(void) cvFindFeatures(struct CvFeatureTree* tr, const CvMat* query_points,
3053  CvMat* indices, CvMat* dist, int k, int emax CV_DEFAULT(20));
3054 
3055 /* Search feature tree for all points that are inlier to given rect region.
3056  Only implemented for kd trees */
3057 CVAPI(int) cvFindFeaturesBoxed(struct CvFeatureTree* tr,
3059  CvMat* out_indices);
3060 
3061 
3062 /* Construct a Locality Sensitive Hash (LSH) table, for indexing d-dimensional vectors of
3063  given type. Vectors will be hashed L times with k-dimensional p-stable (p=2) functions. */
3064 CVAPI(struct CvLSH*) cvCreateLSH(struct CvLSHOperations* ops, int d,
3065  int L CV_DEFAULT(10), int k CV_DEFAULT(10),
3066  int type CV_DEFAULT(CV_64FC1), double r CV_DEFAULT(4),
3067  int64 seed CV_DEFAULT(-1));
3068 
3069 /* Construct in-memory LSH table, with n bins. */
3070 CVAPI(struct CvLSH*) cvCreateMemoryLSH(int d, int n, int L CV_DEFAULT(10), int k CV_DEFAULT(10),
3071  int type CV_DEFAULT(CV_64FC1), double r CV_DEFAULT(4),
3072  int64 seed CV_DEFAULT(-1));
3073 
3074 /* Free the given LSH structure. */
3075 CVAPI(void) cvReleaseLSH(struct CvLSH** lsh);
3076 
3077 /* Return the number of vectors in the LSH. */
3078 CVAPI(unsigned int) LSHSize(struct CvLSH* lsh);
3079 
3080 /* Add vectors to the LSH structure, optionally returning indices. */
3081 CVAPI(void) cvLSHAdd(struct CvLSH* lsh, const CvMat* data, CvMat* indices CV_DEFAULT(0));
3082 
3083 /* Remove vectors from LSH, as addressed by given indices. */
3084 CVAPI(void) cvLSHRemove(struct CvLSH* lsh, const CvMat* indices);
3085 
3086 /* Query the LSH n times for at most k nearest points; data is n x d,
3087  indices and dist are n x k. At most emax stored points will be accessed. */
3088 CVAPI(void) cvLSHQuery(struct CvLSH* lsh, const CvMat* query_points,
3089  CvMat* indices, CvMat* dist, int k, int emax);
3090 
3091 /* Kolmogorov-Zabin stereo-correspondence algorithm (a.k.a. KZ1) */
3092 #define CV_STEREO_GC_OCCLUDED SHRT_MAX
3093 
3094 typedef struct CvStereoGCState
3095 {
3103 
3112 } CvStereoGCState;
3113 
3114 CVAPI(CvStereoGCState*) cvCreateStereoGCState( int numberOfDisparities, int maxIters );
3115 CVAPI(void) cvReleaseStereoGCState( CvStereoGCState** state );
3116 
3117 CVAPI(void) cvFindStereoCorrespondenceGC( const CvArr* left, const CvArr* right,
3119  CvStereoGCState* state,
3120  int useDisparityGuess CV_DEFAULT(0) );
3121 
3122 /* Calculates optical flow for 2 images using classical Lucas & Kanade algorithm */
3123 CVAPI(void) cvCalcOpticalFlowLK( const CvArr* prev, const CvArr* curr,
3125 
3126 /* Calculates optical flow for 2 images using block matching algorithm */
3127 CVAPI(void) cvCalcOpticalFlowBM( const CvArr* prev, const CvArr* curr,
3130  CvArr* velx, CvArr* vely );
3131 
3132 /* Calculates Optical flow for 2 images using Horn & Schunck algorithm */
3133 CVAPI(void) cvCalcOpticalFlowHS( const CvArr* prev, const CvArr* curr,
3134  int use_previous, CvArr* velx, CvArr* vely,
3135  double lambda, CvTermCriteria criteria );
3136 
3137 
3138 /****************************************************************************************\
3139 * Background/foreground segmentation *
3140 \****************************************************************************************/
3141 
3142 /* We discriminate between foreground and background pixels
3143  * by building and maintaining a model of the background.
3144  * Any pixel which does not fit this model is then deemed
3145  * to be foreground.
3146  *
3147  * At present we support two core background models,
3148  * one of which has two variations:
3149  *
3150  * o CV_BG_MODEL_FGD: latest and greatest algorithm, described in
3151  *
3152  * Foreground Object Detection from Videos Containing Complex Background.
3153  * Liyuan Li, Weimin Huang, Irene Y.H. Gu, and Qi Tian.
3154  * ACM MM2003 9p
3155  *
3156  * o CV_BG_MODEL_FGD_SIMPLE:
3157  * A code comment describes this as a simplified version of the above,
3158  * but the code is in fact currently identical
3159  *
3160  * o CV_BG_MODEL_MOG: "Mixture of Gaussians", older algorithm, described in
3161  *
3162  * Moving target classification and tracking from real-time video.
3163  * A Lipton, H Fujijoshi, R Patil
3164  * Proceedings IEEE Workshop on Application of Computer Vision pp 8-14 1998
3165  *
3166  * Learning patterns of activity using real-time tracking
3167  * C Stauffer and W Grimson August 2000
3168  * IEEE Transactions on Pattern Analysis and Machine Intelligence 22(8):747-757
3169  */
3170 
3171 
3172 #define CV_BG_MODEL_FGD 0
3173 #define CV_BG_MODEL_MOG 1 /* "Mixture of Gaussians". */
3174 #define CV_BG_MODEL_FGD_SIMPLE 2
3175 
3176 struct CvBGStatModel;
3177 
3178 typedef void (CV_CDECL * CvReleaseBGStatModel)( struct CvBGStatModel** bg_model );
3180  double learningRate );
3181 
3182 #define CV_BG_STAT_MODEL_FIELDS() \
3183 int type; /*type of BG model*/ \
3184 CvReleaseBGStatModel release; \
3185 CvUpdateBGStatModel update; \
3186 IplImage* background; /*8UC3 reference background image*/ \
3187 IplImage* foreground; /*8UC1 foreground image*/ \
3188 IplImage** layers; /*8UC3 reference background image, can be null */ \
3189 int layer_count; /* can be zero */ \
3190 CvMemStorage* storage; /*storage for foreground_regions*/ \
3191 CvSeq* foreground_regions /*foreground object contours*/
3192 
3193 typedef struct CvBGStatModel
3194 {
3196 } CvBGStatModel;
3197 
3198 //
3199 
3200 // Releases memory used by BGStatModel
3201 CVAPI(void) cvReleaseBGStatModel( CvBGStatModel** bg_model );
3202 
3203 // Updates statistical model and returns number of found foreground regions
3204 CVAPI(int) cvUpdateBGStatModel( IplImage* current_frame, CvBGStatModel* bg_model,
3205  double learningRate CV_DEFAULT(-1));
3206 
3207 // Performs FG post-processing using segmentation
3208 // (all pixels of a region will be classified as foreground if majority of pixels of the region are FG).
3209 // parameters:
3210 // segments - pointer to result of segmentation (for example MeanShiftSegmentation)
3211 // bg_model - pointer to CvBGStatModel structure
3212 CVAPI(void) cvRefineForegroundMaskBySegm( CvSeq* segments, CvBGStatModel* bg_model );
3213 
3214 /* Common use change detection function */
3215 CVAPI(int) cvChangeDetection( IplImage* prev_frame,
3216  IplImage* curr_frame,
3217  IplImage* change_mask );
3218 
3219 /*
3220  Interface of ACM MM2003 algorithm
3221  */
3222 
3223 /* Default parameters of foreground detection algorithm: */
3224 #define CV_BGFG_FGD_LC 128
3225 #define CV_BGFG_FGD_N1C 15
3226 #define CV_BGFG_FGD_N2C 25
3227 
3228 #define CV_BGFG_FGD_LCC 64
3229 #define CV_BGFG_FGD_N1CC 25
3230 #define CV_BGFG_FGD_N2CC 40
3231 
3232 /* Background reference image update parameter: */
3233 #define CV_BGFG_FGD_ALPHA_1 0.1f
3234 
3235 /* stat model update parameter
3236  * 0.002f ~ 1K frame(~45sec), 0.005 ~ 18sec (if 25fps and absolutely static BG)
3237  */
3238 #define CV_BGFG_FGD_ALPHA_2 0.005f
3239 
3240 /* start value for alpha parameter (to fast initiate statistic model) */
3241 #define CV_BGFG_FGD_ALPHA_3 0.1f
3242 
3243 #define CV_BGFG_FGD_DELTA 2
3244 
3245 #define CV_BGFG_FGD_T 0.9f
3246 
3247 #define CV_BGFG_FGD_MINAREA 15.f
3248 
3249 #define CV_BGFG_FGD_BG_UPDATE_TRESH 0.5f
3250 
3251 /* See the above-referenced Li/Huang/Gu/Tian paper
3252  * for a full description of these background-model
3253  * tuning parameters.
3254  *
3255  * Nomenclature: 'c' == "color", a three-component red/green/blue vector.
3256  * We use histograms of these to model the range of
3257  * colors we've seen at a given background pixel.
3258  *
3259  * 'cc' == "color co-occurrence", a six-component vector giving
3260  * RGB color for both this frame and preceding frame.
3261  * We use histograms of these to model the range of
3262  * color CHANGES we've seen at a given background pixel.
3263  */
3264 typedef struct CvFGDStatModelParams
3265 {
3266  int Lc; /* Quantized levels per 'color' component. Power of two, typically 32, 64 or 128. */
3267  int N1c; /* Number of color vectors used to model normal background color variation at a given pixel. */
3268  int N2c; /* Number of color vectors retained at given pixel. Must be > N1c, typically ~ 5/3 of N1c. */
3269  /* Used to allow the first N1c vectors to adapt over time to changing background. */
3270 
3271  int Lcc; /* Quantized levels per 'color co-occurrence' component. Power of two, typically 16, 32 or 64. */
3272  int N1cc; /* Number of color co-occurrence vectors used to model normal background color variation at a given pixel. */
3273  int N2cc; /* Number of color co-occurrence vectors retained at given pixel. Must be > N1cc, typically ~ 5/3 of N1cc. */
3274  /* Used to allow the first N1cc vectors to adapt over time to changing background. */
3275 
3276  int is_obj_without_holes;/* If TRUE we ignore holes within foreground blobs. Defaults to TRUE. */
3277  int perform_morphing; /* Number of erode-dilate-erode foreground-blob cleanup iterations. */
3278  /* These erase one-pixel junk blobs and merge almost-touching blobs. Default value is 1. */
3279 
3280  float alpha1; /* How quickly we forget old background pixel values seen. Typically set to 0.1 */
3281  float alpha2; /* "Controls speed of feature learning". Depends on T. Typical value circa 0.005. */
3282  float alpha3; /* Alternate to alpha2, used (e.g.) for quicker initial convergence. Typical value 0.1. */
3283 
3284  float delta; /* Affects color and color co-occurrence quantization, typically set to 2. */
3285  float T; /* "A percentage value which determines when new features can be recognized as new background." (Typically 0.9).*/
3286  float minArea; /* Discard foreground blobs whose bounding box is smaller than this threshold. */
3288 
3289 typedef struct CvBGPixelCStatTable
3290 {
3291  float Pv, Pvb;
3292  uchar v[3];
3294 
3295 typedef struct CvBGPixelCCStatTable
3296 {
3297  float Pv, Pvb;
3298  uchar v[6];
3300 
3301 typedef struct CvBGPixelStat
3302 {
3303  float Pbc;
3304  float Pbcc;
3309 } CvBGPixelStat;
3310 
3311 
3312 typedef struct CvFGDStatModel
3313 {
3320 } CvFGDStatModel;
3321 
3322 /* Creates FGD model */
3323 CVAPI(CvBGStatModel*) cvCreateFGDStatModel( IplImage* first_frame,
3324  CvFGDStatModelParams* parameters CV_DEFAULT(NULL));
3325 
3326 /*
3327  Interface of Gaussian mixture algorithm
3328 
3329  "An improved adaptive background mixture model for real-time tracking with shadow detection"
3330  P. KadewTraKuPong and R. Bowden,
3331  Proc. 2nd European Workshp on Advanced Video-Based Surveillance Systems, 2001."
3332  http://personal.ee.surrey.ac.uk/Personal/R.Bowden/publications/avbs01/avbs01.pdf
3333  */
3334 
3335 /* Note: "MOG" == "Mixture Of Gaussians": */
3336 
3337 #define CV_BGFG_MOG_MAX_NGAUSSIANS 500
3338 
3339 /* default parameters of gaussian background detection algorithm */
3340 #define CV_BGFG_MOG_BACKGROUND_THRESHOLD 0.7 /* threshold sum of weights for background test */
3341 #define CV_BGFG_MOG_STD_THRESHOLD 2.5 /* lambda=2.5 is 99% */
3342 #define CV_BGFG_MOG_WINDOW_SIZE 200 /* Learning rate; alpha = 1/CV_GBG_WINDOW_SIZE */
3343 #define CV_BGFG_MOG_NGAUSSIANS 5 /* = K = number of Gaussians in mixture */
3344 #define CV_BGFG_MOG_WEIGHT_INIT 0.05
3345 #define CV_BGFG_MOG_SIGMA_INIT 30
3346 #define CV_BGFG_MOG_MINAREA 15.f
3347 
3348 
3349 #define CV_BGFG_MOG_NCOLORS 3
3350 
3352 {
3353  int win_size; /* = 1/alpha */
3354  int n_gauss;
3358 
3359 typedef struct CvGaussBGValues
3360 {
3362  double weight;
3363  double variance[CV_BGFG_MOG_NCOLORS];
3364  double mean[CV_BGFG_MOG_NCOLORS];
3365 } CvGaussBGValues;
3366 
3367 typedef struct CvGaussBGPoint
3368 {
3370 } CvGaussBGPoint;
3371 
3372 
3373 typedef struct CvGaussBGModel
3374 {
3379  void* mog;
3380 } CvGaussBGModel;
3381 
3382 
3383 /* Creates Gaussian mixture background model */
3384 CVAPI(CvBGStatModel*) cvCreateGaussianBGModel( IplImage* first_frame,
3385  CvGaussBGStatModelParams* parameters CV_DEFAULT(NULL));
3386 
3387 
3388 typedef struct CvBGCodeBookElem
3389 {
3390  struct CvBGCodeBookElem* next;
3392  int stale;
3398 
3399 typedef struct CvBGCodeBookModel
3400 {
3402  int t;
3410 
3411 CVAPI(CvBGCodeBookModel*) cvCreateBGCodeBookModel( void );
3412 CVAPI(void) cvReleaseBGCodeBookModel( CvBGCodeBookModel** model );
3413 
3414 CVAPI(void) cvBGCodeBookUpdate( CvBGCodeBookModel* model, const CvArr* image,
3415  CvRect roi CV_DEFAULT(cvRect(0,0,0,0)),
3416  const CvArr* mask CV_DEFAULT(0) );
3417 
3418 CVAPI(int) cvBGCodeBookDiff( const CvBGCodeBookModel* model, const CvArr* image,
3419  CvArr* fgmask, CvRect roi CV_DEFAULT(cvRect(0,0,0,0)) );
3420 
3421 CVAPI(void) cvBGCodeBookClearStale( CvBGCodeBookModel* model, int staleThresh,
3422  CvRect roi CV_DEFAULT(cvRect(0,0,0,0)),
3423  const CvArr* mask CV_DEFAULT(0) );
3424 
3425 CVAPI(CvSeq*) cvSegmentFGMask( CvArr *fgmask, int poly1Hull0 CV_DEFAULT(1),
3426  float perimScale CV_DEFAULT(4.f),
3427  CvMemStorage* storage CV_DEFAULT(0),
3428  CvPoint offset CV_DEFAULT(cvPoint(0,0)));
3429 
3430 #ifdef __cplusplus
3431 }
3432 #endif
3433 
3434 #endif
3435 
3436 /* End of file. */
uchar * data()
Definition: legacy.hpp:1625
int dims
Definition: core_c.h:218
CvArr double double CvMemStorage * storage
Definition: legacy.hpp:55
int obs_y
Definition: legacy.hpp:109
BruteForceMatcher(Distance d=Distance())
Definition: legacy.hpp:2827
int m_pyr_levels
Definition: legacy.hpp:2543
double lambdaMin
Definition: legacy.hpp:1867
float ** flSamples
Definition: legacy.hpp:1166
int nEigObjs
Definition: legacy.hpp:93
int id
Definition: legacy.hpp:894
int height
Definition: types_c.h:482
CvMat * dispRight
Definition: legacy.hpp:3107
IplImage ** m_samples
Definition: legacy.hpp:2352
int n_gauss
Definition: legacy.hpp:3354
double double double double double * convTransVect
Definition: legacy.hpp:563
int int obsSize
Definition: legacy.hpp:170
GLdouble GLdouble GLdouble r
GLuint GLenum matrix
uchar modMin[3]
Definition: legacy.hpp:3404
float * DynamMatr
Definition: legacy.hpp:1163
double * min_val
Definition: core_c.h:833
Definition: legacy.hpp:2208
float * State
Definition: legacy.hpp:1164
float * obs
Definition: legacy.hpp:191
CvEM ExpectationMaximization
Definition: legacy.hpp:1840
Definition: legacy.hpp:1346
int GetCameraCount() const
Definition: legacy.hpp:1246
Definition: legacy.hpp:2836
Size patchSize
Definition: legacy.hpp:1992
CvImage(CvSize _size, int _depth, int _channels)
Definition: legacy.hpp:1350
virtual void read(const FileNode &fn)
Definition: legacy.hpp:2807
CV_EXPORTS_W double norm(InputArray src1, int normType=NORM_L2, InputArray mask=noArray())
computes norm of the selected array part
double clusteringDistance
Definition: legacy.hpp:1899
CvImage(const CvImage &img)
Definition: legacy.hpp:1361
Definition: legacy.hpp:1510
int framesTotal
Definition: legacy.hpp:1338
int GetPCADimHigh() const
Definition: legacy.hpp:2514
IplImage uchar int int * scanlines
Definition: legacy.hpp:1096
struct CvStereoGCState CvStereoGCState
struct CvEHMM CvEHMM
uchar * ptr(int i0=0)
returns pointer to i0-th submatrix along the dimension #0
Definition: mat.hpp:414
Definition: legacy.hpp:863
GLenum GLint GLint y
Definition: core_c.h:613
float Pv
Definition: legacy.hpp:3291
Definition: legacy.hpp:504
Definition: compat.hpp:143
double * lineCoef
Definition: legacy.hpp:716
void set(CvMat *m, bool add_ref)
Definition: legacy.hpp:1552
GLenum mode
CvFileNode * node
Definition: core_c.h:1638
struct CvCamera CvCamera
struct CvLCMNode CvLCMNode
Random Number Generator.
Definition: core.hpp:2019
GLenum GLenum GLenum input
Definition: legacy.hpp:84
int int int int * dy
CvPoint2D32f CvPoint2D32f * warpPoint
Definition: legacy.hpp:547
CvRect rect
Definition: legacy.hpp:2927
int height
Definition: types_c.h:508
Definition: legacy.hpp:2005
struct CvBGPixelCCStatTable CvBGPixelCCStatTable
CvPoint2D32f p2
Definition: legacy.hpp:578
Definition: legacy.hpp:920
CvPoint3D64f CvPoint3D64f point21
Definition: legacy.hpp:611
IplImage CvRect * roi
Definition: legacy.hpp:234
CvPoint2D32f principal_point
Definition: legacy.hpp:924
Definition: types_c.h:1021
float stepScale
Definition: legacy.hpp:2647
Size patchSize
Definition: legacy.hpp:2642
Definition: legacy.hpp:1972
CvSeq * cvMorphContours(const CvSeq *contour1, const CvSeq *contour2, CvSeq *corr, double alpha, CvMemStorage *storage)
struct CvVoronoiEdge2D CvVoronoiEdge2D
const IplImage CvRect int nRects
Definition: legacy.hpp:867
CvMat CvMat * upper_bound
Definition: legacy.hpp:1187
double ZcoefB
Definition: legacy.hpp:499
Definition: legacy.hpp:273
float scale_min
Definition: legacy.hpp:2544
GLint level
Definition: tracking.hpp:88
size_t CvSubdiv2DEdge
Definition: types_c.h:447
OneWayDescriptor * m_descriptors
Definition: legacy.hpp:2527
int nviews
Definition: legacy.hpp:2716
int int * scanlinesA
Definition: legacy.hpp:1124
int * state
Definition: legacy.hpp:113
Definition: legacy.hpp:1211
const char const char ** filename
Definition: core_c.h:1750
CvMat int int CvMat int num_classes
Definition: ml.hpp:1999
~CvImage()
Definition: legacy.hpp:1375
int imax
Definition: legacy.hpp:540
CvSize m_patch_size
Definition: legacy.hpp:2351
const CvContourTree int method
Definition: legacy.hpp:771
int N1c
Definition: legacy.hpp:3267
uchar uchar * prewarp2
Definition: legacy.hpp:1104
Definition: features2d.hpp:1201
Definition: types_c.h:462
CvPoint2D32f CvPoint2D32f int direction
Definition: legacy.hpp:547
GLuint start
static const int DEFAULT_DEPTH
Definition: legacy.hpp:2026
int nstructs
Definition: legacy.hpp:2714
float best_weight
Definition: legacy.hpp:325
virtual void hash_insert(lsh_hash h, int l, int i)=0
Definition: legacy.hpp:3359
struct CvGaussBGValues CvGaussBGValues
CvPoint CvPoint pt2
Definition: core_c.h:1270
int occlusionCost
Definition: legacy.hpp:3099
int m_pose_count
Definition: legacy.hpp:2525
int CvEHMM * hmm
Definition: legacy.hpp:200
int pix_size() const
Definition: legacy.hpp:1623
CvMat probsHdr
Definition: legacy.hpp:1833
int get_hist_dims(int *dims=0) const
Definition: legacy.hpp:1678
Definition: ml.hpp:572
Definition: legacy.hpp:1217
int Lc
Definition: legacy.hpp:3266
vector< int > classCounters
Definition: legacy.hpp:1994
virtual int descriptorType() const
Definition: legacy.hpp:2768
CvPoint2D64f CvPoint2D64f CvPoint2D64f double double * rotMatr1
Definition: legacy.hpp:595
int Lcc
Definition: legacy.hpp:3271
IplImage int int desired_num_channels
Definition: legacy.hpp:718
int channels() const
Definition: legacy.hpp:1454
int(CV_CDECL * CvCallback)(int index, void *buffer, void *user_data)
Definition: legacy.hpp:64
Definition: legacy.hpp:2759
CvMatrix(int _rows, int _cols, int _type, void *_data, int _step=CV_AUTOSTEP)
Definition: legacy.hpp:1523
Definition: ml.hpp:562
const CvArr CvArr * fgmask
Definition: legacy.hpp:3418
CvMemStorage ** pVoronoiStorage
Definition: legacy.hpp:1037
CvBGPixelCStatTable * ctable
Definition: legacy.hpp:3305
GLXFBConfig int GLXContext Bool direct
CvVoronoiDiagram2D CvMemStorage * VoronoiStorage
Definition: legacy.hpp:1021
void addref() const
Definition: legacy.hpp:1568
IplImage int desired_depth
Definition: legacy.hpp:718
Definition: legacy.hpp:1873
int h2
Definition: legacy.hpp:2889
const CvArr CvSize CvSize CvSize int use_previous
Definition: legacy.hpp:3127
IplImage * m_train_patch
Definition: legacy.hpp:2354
int * ce
Definition: legacy.hpp:317
struct Cv3dTracker2dTrackedObject Cv3dTracker2dTrackedObject
int CvSeq float * line
Definition: legacy.hpp:237
File Storage Node class.
Definition: core.hpp:4119
float fundMatr[9]
Definition: legacy.hpp:518
int CvSeq * indexs
Definition: legacy.hpp:237
float theta
Definition: legacy.hpp:2212
CvPoint3D64f CvPoint3D64f CvPoint3D64f point22
Definition: legacy.hpp:611
Definition: types_c.h:921
Size2i Size
Definition: core.hpp:896
Definition: legacy.hpp:2694
CvGaussBGValues * g_values
Definition: legacy.hpp:3369
CvMat * tempImg
Definition: legacy.hpp:1320
Definition: legacy.hpp:1954
void set_data(void *_data, int _step=CV_AUTOSTEP)
Definition: legacy.hpp:1629
double betta
Definition: legacy.hpp:558
const CvArr * curr
Definition: legacy.hpp:3123
CvHistogram * hist
Definition: legacy.hpp:288
CvPoint2D64f CvPoint2D64f point3
Definition: legacy.hpp:595
CvSize GetPatchSize() const
Definition: legacy.hpp:2292
uchar uchar int int * line_lengths2
Definition: legacy.hpp:1104
int depth() const
Definition: legacy.hpp:1621
int int int * lengths
Definition: legacy.hpp:1124
Definition: types_c.h:951
int int vtx_size
Definition: legacy.hpp:2930
Definition: types_c.h:1459
CvSize size
Definition: legacy.hpp:3401
CvEHMMState * state
Definition: legacy.hpp:139
Feature(int _x1, int _y1, int _x2, int _y2)
Definition: legacy.hpp:1958
Definition: types_c.h:1138
const uchar * roi_row(int y) const
Definition: legacy.hpp:1476
const Cv3dTrackerCameraIntrinsics CvSize etalon_size
Definition: legacy.hpp:936
IplImage * img_mask
Definition: legacy.hpp:234
CvPoint2D64f CvPoint2D64f CvPoint2D64f double double double double * camMatr2
Definition: legacy.hpp:595
CvSeq * contour
Definition: core_c.h:1431
const CvArr CvSize block_size
Definition: legacy.hpp:3127
double Zcoef
Definition: legacy.hpp:497
int staleThresh
Definition: legacy.hpp:3421
struct CvEHMMState CvEHMMState
float * inv_var
Definition: legacy.hpp:124
void int int uchar void IplImage * avg
Definition: legacy.hpp:78
float alpha1
Definition: legacy.hpp:3280
int weighted
Definition: legacy.hpp:323
int win_size
Definition: legacy.hpp:3353
const int * idx
Definition: core_c.h:323
float lambda2
Definition: legacy.hpp:2214
struct CvGaussBGModel CvGaussBGModel
IplImage CvRect int CvPoint double * dbAngleRotate
Definition: legacy.hpp:869
CvRect RightEyeRect
Definition: legacy.hpp:879
Definition: legacy.hpp:3289
Definition: legacy.hpp:1904
int height
Definition: types_c.h:1141
bool isCalibrated
Definition: legacy.hpp:1340
int prevTrainCount
Definition: legacy.hpp:2685
CvPoint2D64f p_end
Definition: legacy.hpp:633
bool IsCalibrated() const
Definition: legacy.hpp:1255
int m_train_feature_count
Definition: legacy.hpp:2526
Definition: miniflann.hpp:130
virtual int descriptorSize() const
Definition: legacy.hpp:2767
Definition: legacy.hpp:906
CvMat CvMat CvMat * out_indices
Definition: legacy.hpp:3058
Definition: legacy.hpp:2138
CvMat CvMat * bounds_max
Definition: legacy.hpp:3058
int m_threshold
Definition: legacy.hpp:1736
Definition: legacy.hpp:305
double ZcoefAB
Definition: legacy.hpp:500
const OneWayDescriptor * GetDescriptor(int desc_idx) const
Definition: legacy.hpp:2421
Definition: legacy.hpp:2697
Definition: types_c.h:53
CvSize GetInputPatchSize() const
Definition: legacy.hpp:2299
GLsizei GLsizei GLuint * obj
int maxPoints
Definition: legacy.hpp:1337
GLuint src
Definition: core_c.h:1650
const CvMat * means
Definition: legacy.hpp:1760
float scale_step
Definition: legacy.hpp:2546
int obs_size
Definition: legacy.hpp:110
int signatureSize
Definition: legacy.hpp:1989
void int double rho
Definition: imgproc_c.h:603
static void runByImageBorder(vector< KeyPoint > &keypoints, Size imageSize, int borderSize)
CvMat * left
Definition: legacy.hpp:3104
CVAPI(CvSeq *) cvSegmentImage(const CvArr *srcarr
Definition: legacy.hpp:928
int num_states
Definition: legacy.hpp:133
CV_PROP_RW CvTermCriteria term_crit
Definition: legacy.hpp:1762
int N
Definition: legacy.hpp:309
CV_INLINE CvPoint cvPoint(int x, int y)
Definition: types_c.h:1029
uchar int uchar * second_pix
Definition: legacy.hpp:1133
void detach()
Definition: legacy.hpp:1408
int m_pca_dim_high
Definition: legacy.hpp:2540
GLuint index
Definition: core_c.h:986
const CvArr int CvArr CvArr double lambda
Definition: legacy.hpp:3133
int countFrames
Definition: legacy.hpp:3378
IplImage CvMemStorage CvSeq int double double threshold2
Definition: legacy.hpp:2917
int y
Definition: legacy.hpp:2008
vector< Feature > features
Definition: legacy.hpp:1993
CvPoint2D32f CvPoint2D32f v2_start
Definition: legacy.hpp:577
const CvArr CvSize CvArr CvArr * vely
Definition: legacy.hpp:3123
CvPoint2D64f double double double int * result
Definition: legacy.hpp:633
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: core_c.h:403
int(CV_CDECL * CvUpdateBGStatModel)(IplImage *curr_frame, struct CvBGStatModel *bg_model, double learningRate)
Definition: legacy.hpp:3179
int d
Definition: legacy.hpp:3064
Definition: legacy.hpp:268
CV_INLINE CvSubdiv2DPoint * cvSubdiv2DEdgeDst(CvSubdiv2DEdge edge)
Definition: legacy.hpp:3003
int num_mix
Definition: legacy.hpp:122
_Tp x
Definition: core.hpp:766
void attach(IplImage *img, bool use_refcount=true)
Definition: legacy.hpp:1397
double * lineCoeff
Definition: legacy.hpp:713
Definition: ml.hpp:566
CvMat * vtxBuf
Definition: legacy.hpp:3110
CvArr double double ffill_threshold
Definition: legacy.hpp:55
struct CvLCMEdge CvLCMEdge
float imgSize[2]
Definition: legacy.hpp:506
CvRect r
Definition: core_c.h:1282
Definition: legacy.hpp:1053
const CvMat const CvMat const CvMat CvMat CvMat CvMat CvMat CvSize CvMat CvMat * T
Definition: calib3d.hpp:270
Definition: legacy.hpp:1212
int N1cc
Definition: legacy.hpp:3272
int k
Definition: legacy.hpp:312
CvSize int int int int int * line_count
Definition: legacy.hpp:1088
uchar int * first_num
Definition: legacy.hpp:1133
static float GET_MAX_SCALE()
Definition: legacy.hpp:2631
Feature()
Definition: legacy.hpp:1957
int int int int int int * second_corr
Definition: legacy.hpp:1115
Definition: legacy.hpp:1213
int CvSize CvPoint2D32f CvPoint2D32f * imagePoints2
Definition: legacy.hpp:581
int void * eigInput
Definition: legacy.hpp:93
GLXFBConfig Window win
CvRect LeftEyeRect
Definition: legacy.hpp:878
CvPoint3D32f p
Definition: legacy.hpp:909
CvPoint p2
Definition: legacy.hpp:754
uchar cbBounds[3]
Definition: legacy.hpp:3403
CvSize GetPatchSize() const
Definition: legacy.hpp:2401
CvMat * m_pca_descriptors_matrix
Definition: legacy.hpp:2535
CV_INLINE double cvTriangleArea(CvPoint2D32f a, CvPoint2D32f b, CvPoint2D32f c)
Definition: legacy.hpp:3032
uchar int * src_nums
Definition: legacy.hpp:1150
double XcoefA
Definition: legacy.hpp:488
struct CvBGPixelCStatTable CvBGPixelCStatTable
CvMat * bounds_min
Definition: legacy.hpp:3058
CvRNG * rng
Definition: core_c.h:652
float * cur_weight
Definition: legacy.hpp:328
struct CvCliqueFinder CvCliqueFinder
Definition: legacy.hpp:130
const CvArr CvSize CvSize shift_size
Definition: legacy.hpp:3127
unsigned char CvBool
Definition: legacy.hpp:890
int classes() const
Definition: legacy.hpp:2172
double double double double double double CvSize double double double * fundMatr
Definition: legacy.hpp:680
void * data
Definition: legacy.hpp:68
CvBGStatModel * bg_model
Definition: legacy.hpp:3204
static const int DEFAULT_VIEWS
Definition: legacy.hpp:2027
int x
Definition: legacy.hpp:2007
CvPoint3D64f CvPoint3D64f CvPoint3D64f CvPoint3D64f * midPoint
Definition: legacy.hpp:611
virtual void vector_remove(int i)=0
double ZcoefA
Definition: legacy.hpp:498
CvSeq * cvFindFace(IplImage *Image, CvMemStorage *storage)
CvMat * undistImg
Definition: legacy.hpp:1329
uchar boxMax[3]
Definition: legacy.hpp:3394
void void int int void CvTermCriteria * calcLimit
Definition: legacy.hpp:84
The Keypoint Class.
Definition: features2d.hpp:69
float max
Definition: legacy.hpp:539
FernClassifier fernClassifier
Definition: legacy.hpp:2881
GLXDrawable GLXDrawable read
CV_INLINE int iplHeight(const IplImage *img)
Definition: legacy.hpp:1194
struct CvGLCM CvGLCM
Definition: legacy.hpp:831
Definition: legacy.hpp:281
BaseKeypoint()
Definition: legacy.hpp:2011
Definition: types_c.h:1155
Definition: legacy.hpp:3388
Definition: legacy.hpp:106
float lambda
Definition: legacy.hpp:3098
CvMat * edgeBuf
Definition: legacy.hpp:3111
CvPoint2D64f CvPoint2D64f CvPoint2D64f double double double double double double CvStereoLineCoeff int * needSwapCameras
Definition: legacy.hpp:595
char * imageData
Definition: types_c.h:490
int GetPyrLevels() const
Definition: legacy.hpp:2406
CvHistogram * m_hist
Definition: legacy.hpp:1726
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: highgui_c.h:230
Definition: legacy.hpp:515
struct CvImgObsInfo CvImgObsInfo
CV_INLINE CvSize cvSize(int width, int height)
Definition: types_c.h:1145
float lambda1
Definition: legacy.hpp:3098
const CvPoint2D32f double matrix[3][3]
Definition: legacy.hpp:1070
void void * output
Definition: legacy.hpp:84
const Cv3dTrackerCameraIntrinsics CvSize float square_size
Definition: legacy.hpp:936
Definition: legacy.hpp:3367
CvPoint2D32f CvPoint2D32f CvPoint2D32f v2_end
Definition: legacy.hpp:577
float * edge_weights
Definition: legacy.hpp:326
double CvPoint2D64f * projectPoint
Definition: legacy.hpp:713
vector< KeyPoint > & GetLabeledFeatures()
Definition: legacy.hpp:2585
struct CvFGDStatModel CvFGDStatModel
int ** adj_matr
Definition: legacy.hpp:308
CV_EXPORTS_W void write(FileStorage &fs, const string &name, int value)
const CvMat * weights
Definition: legacy.hpp:1759
IplImage * m_temp
Definition: legacy.hpp:1740
CvVoronoiDiagram2D ** VoronoiDiagram
Definition: legacy.hpp:1021
CvPoint2D64f CvPoint2D64f CvPoint2D64f double * camMatr1
Definition: legacy.hpp:595
uchar is_trained_st_model
Definition: legacy.hpp:3307
CvMat weightsHdr
Definition: legacy.hpp:1832
struct CvFaceTracker CvFaceTracker
Definition: legacy.hpp:857
CvPoint int float float float int coeff_usage
Definition: legacy.hpp:798
CvArr * dstarr
Definition: legacy.hpp:55
CvMat meansHdr
Definition: legacy.hpp:1829
const CvArr int CvArr * dispImage
Definition: legacy.hpp:470
const char const char const char * file_name
Definition: core_c.h:1743
void clear(const ColorA &color=ColorA::black(), bool clearDepthBuffer=true)
int cols() const
Definition: legacy.hpp:1613
CvPoint2D32f pt
Definition: legacy.hpp:2948
CvNextEdgeType
Definition: types_c.h:499
Definition: legacy.hpp:964
double CvStereoLineCoeff CvPoint3D64f * point
Definition: legacy.hpp:558
CV_PROP_RW int start_step
Definition: legacy.hpp:1757
bool set_min_ch_val(int channel, int val)
Definition: legacy.hpp:1698
double double double * transVect2
Definition: legacy.hpp:563
CV_INLINE CvSubdiv2DEdge cvSubdiv2DGetEdge(CvSubdiv2DEdge edge, CvNextEdgeType type)
Definition: legacy.hpp:2988
Definition: legacy.hpp:65
int void int void IplImage float * coeffs
Definition: legacy.hpp:93
const CvPoint2D32f vertex[4]
Definition: legacy.hpp:1070
IplImage IplImage * change_mask
Definition: legacy.hpp:3216
Definition: legacy.hpp:3264
The 2D size class.
Definition: core.hpp:81
float alpha2
Definition: legacy.hpp:3281
IplImage * eigObj
Definition: legacy.hpp:90
CV_INLINE CvSubdiv2DPoint * cvSubdiv2DEdgeOrg(CvSubdiv2DEdge edge)
Definition: legacy.hpp:2996
double YcoefAB
Definition: legacy.hpp:495
struct CvRandState * RandS
Definition: legacy.hpp:1172
double double double double double double CvSize double double double CvPoint3D64f CvPoint3D64f * epipole2
Definition: legacy.hpp:680
Definition: legacy.hpp:1014
CvEHMM * ehmm
Definition: legacy.hpp:196
CV_EXPORTS void set(Mat &dst, const Scalar &gamma, const Mat &mask=Mat())
int int void float IplImage IplImage * proj
Definition: legacy.hpp:98
float * RandomSample
Definition: legacy.hpp:1171
int imin
Definition: legacy.hpp:540
struct CvContourTree CvContourTree
CV_INLINE CvTermCriteria cvTermCriteria(int type, int max_iter, double epsilon)
Definition: types_c.h:1007
CvSize int * scanlines1
Definition: legacy.hpp:1088
float delta
Definition: legacy.hpp:3284
LDetector YAPE
Definition: legacy.hpp:1902
CvRect roi() const
Definition: legacy.hpp:1440
float ** obsProb
Definition: legacy.hpp:135
Definition: legacy.hpp:3301
int match_sum
Definition: legacy.hpp:3361
const CvArr CvSize CvSize CvSize max_range
Definition: legacy.hpp:3127
string pcaFilename
Definition: legacy.hpp:2643
struct CvVoronoiSite2D CvVoronoiSite2D
static const uchar PATCH_SIZE
Definition: legacy.hpp:2025
const GLbyte * weights
struct CvEHMM * ehmm
Definition: legacy.hpp:141
float rotMatrix[9]
Definition: legacy.hpp:529
double * areaLineCoef2
Definition: legacy.hpp:698
const CvMat CvMat CvMat int int emax
Definition: legacy.hpp:3088
int m_pca_dim_low
Definition: legacy.hpp:2363
GLint GLvoid * img
Definition: legacy.hpp:1150
Definition: legacy.hpp:864
Definition: legacy.hpp:2557
static const size_t DEFAULT_REDUCED_NUM_DIM
Definition: legacy.hpp:2028
static const int DEFAULT_TREES
Definition: legacy.hpp:2141
PatchGenerator patchGenerator
Definition: legacy.hpp:2718
Definition: legacy.hpp:1079
Definition: legacy.hpp:2369
double double * rotMatr2
Definition: legacy.hpp:563
bool verbose
Definition: legacy.hpp:2877
SourceFileRef load(const DataSourceRef &dataSource, size_t sampleRate=0)
double minArea
Definition: legacy.hpp:3355
float alpha3
Definition: legacy.hpp:3282
int nstructs
Definition: legacy.hpp:1986
double coeffs[2][3][3]
Definition: legacy.hpp:524
double XcoefAB
Definition: legacy.hpp:490
CvPoint3D64f CvPoint3D64f point2
Definition: legacy.hpp:552
double double double double * convRotMatr
Definition: legacy.hpp:563
int poseCount
Definition: legacy.hpp:2641
CvPoint3D64f * M1
Definition: legacy.hpp:570
void int ioFlags
Definition: legacy.hpp:78
virtual int vector_add(const void *data)=0
static float GET_STEP_SCALE()
Definition: legacy.hpp:2632
Definition: legacy.hpp:2217
int Write(int fd, const void *buf, unsigned int count)
Definition: ts_gtest.h:2944
float mat[4][4]
Definition: legacy.hpp:923
int * numMix
Definition: legacy.hpp:170
bool randomBlur
Definition: legacy.hpp:1866
CV_INLINE CvSubdiv2D * cvCreateSubdivDelaunay2D(CvRect rect, CvMemStorage *storage)
Definition: legacy.hpp:2937
const uchar * data() const
Definition: legacy.hpp:1626
int DP
Definition: legacy.hpp:1162
CvMatrix(const CvMatrix &m)
Definition: legacy.hpp:1530
CV_GRAPH_VERTEX_FIELDS() CvContour *contour
CvCalibEtalonType
Definition: legacy.hpp:1209
float egvals[2]
Definition: legacy.hpp:536
std::vector< CvMat * > covsPtrs
Definition: legacy.hpp:1831
Ptr< OneWayDescriptorBase > base
Definition: legacy.hpp:2683
CvPoint3D32f float * intrinsic
Definition: legacy.hpp:251
CvMatrix(CvFileStorage *fs, const char *mapname, const char *matname)
Definition: legacy.hpp:1539
int * refcount
Definition: legacy.hpp:1506
const CvMat * query_points
Definition: legacy.hpp:3052
GLuint GLfloat * val
float minArea
Definition: legacy.hpp:3286
Definition: legacy.hpp:1970
Definition: legacy.hpp:750
cv::flann::Index * m_pca_descriptors_tree
Definition: legacy.hpp:2534
int get_threshold() const
Definition: legacy.hpp:1675
int num_img
Definition: legacy.hpp:200
Definition: legacy.hpp:3094
CvMat ** m_transforms
Definition: legacy.hpp:2357
float Pvb
Definition: legacy.hpp:3291
int get_min_ch_val(int channel) const
Definition: legacy.hpp:1681
int prevTrainCount
Definition: legacy.hpp:2751
float Pbc
Definition: legacy.hpp:3303
double CvPoint2D64f CvSize CvPoint2D64f * point11
Definition: legacy.hpp:698
CvPoint2D32f CvSubdiv2DEdge * edge
Definition: legacy.hpp:2954
uchar uchar int int int int * runs2
Definition: legacy.hpp:1104
double CvPoint2D64f epipole
Definition: legacy.hpp:698
CvPoint3D64f point12
Definition: legacy.hpp:611
CvMatrix()
Definition: legacy.hpp:1513
IplImage CvMemStorage CvSeq ** comp
Definition: legacy.hpp:2917
Definition: legacy.hpp:485
CvImage(CvFileStorage *fs, const char *seqname, int idx)
Definition: legacy.hpp:1372
virtual void read(CvFileStorage *storage, CvFileNode *node)
float min
Definition: legacy.hpp:539
uchar * getData(IplImage *image)
Definition: legacy.hpp:2096
int radius
Definition: legacy.hpp:1892
float * flCumulative
Definition: legacy.hpp:1169
uchar learnMin[3]
Definition: legacy.hpp:3395
Definition: legacy.hpp:995
int ** All
Definition: legacy.hpp:314
int CvSeq float CvSize2D32f int CvPoint3D32f * center
Definition: legacy.hpp:237
static float GET_LOWER_QUANT_PERC()
Definition: legacy.hpp:2029
GLint * first
Definition: legacy.hpp:1133
double double double double double double CvSize double double quad2[4][2]
Definition: legacy.hpp:680
int N2cc
Definition: legacy.hpp:3273
CV_INLINE int iplWidth(const IplImage *img)
Definition: legacy.hpp:1189
int double double * standardDeviation
Definition: legacy.hpp:847
int t
Definition: legacy.hpp:3402
int status
Definition: legacy.hpp:321
int type() const
Definition: legacy.hpp:1620
uchar uchar int int int * runs1
Definition: legacy.hpp:1104
CvMemStorage double threshold
Definition: legacy.hpp:759
const CvArr * image
Definition: legacy.hpp:3414
const CvArr CvSeq ** keypoints
Definition: compat.hpp:647
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: legacy.hpp:3084
static float GET_UPPER_QUANT_PERC()
Definition: legacy.hpp:2030
uchar uchar int int int int int * num_runs1
Definition: legacy.hpp:1104
double thetaMin
Definition: legacy.hpp:1868
IplImage * prev_frame
Definition: legacy.hpp:3318
CvAffinePose * m_poses
Definition: legacy.hpp:2537
cv::EM emObj
Definition: legacy.hpp:1825
virtual ~CvLSHOperations()
Definition: legacy.hpp:2894
double noiseRange
Definition: legacy.hpp:1865
Definition: legacy.hpp:2888
CvMemStorage * storage
Definition: legacy.hpp:1321
union CvEHMM::@329 u
GLenum GLsizei GLsizei height
void create(CvSize _size, int _depth, int _channels)
Definition: legacy.hpp:1386
int N2c
Definition: legacy.hpp:3268
std::string String
Definition: core.hpp:85
CvPoint2D32f principal_point
Definition: legacy.hpp:930
GLclampf GLclampf GLclampf alpha
Definition: core_c.h:687
const CvPoint * pts
Definition: core_c.h:1315
CvSize m_patch_size
Definition: legacy.hpp:2524
GLuint GLenum GLenum transform
std::vector< CvMat > covsHdrs
Definition: legacy.hpp:1830
string m_feature_name
Definition: legacy.hpp:2359
int width() const
Definition: legacy.hpp:1428
IplImage uchar int * dst_nums
Definition: legacy.hpp:1096
void clear()
Definition: legacy.hpp:1597
int * fixp
Definition: legacy.hpp:318
Definition: types_c.h:1272
int classes()
Definition: legacy.hpp:2056
virtual void write(CvFileStorage *storage, const char *name) const
struct CvStereoLineCoeff CvStereoLineCoeff
float width
Definition: legacy.hpp:1048
double std_threshold
Definition: legacy.hpp:3355
int int int int * second_runs
Definition: legacy.hpp:1115
int * nums
Definition: legacy.hpp:581
CvCalibEtalonType etalonType
Definition: legacy.hpp:1313
Definition: features2d.hpp:1273
int header_size
Definition: legacy.hpp:2930
CvRect get_window() const
Definition: legacy.hpp:1671
float * mu
Definition: legacy.hpp:123
int cameraCount
Definition: legacy.hpp:1324
cv::Mat probs
Definition: legacy.hpp:1826
CvImage(CvFileStorage *fs, const char *mapname, const char *imgname)
Definition: legacy.hpp:1369
GLuint buffer
struct CvContourOrientation CvContourOrientation
int index
Definition: core_c.h:309
double double double CvPoint2D64f * projPoint
Definition: legacy.hpp:676
CvPoint3D64f double * rotMatr
Definition: legacy.hpp:570
bool verbose
Definition: legacy.hpp:1985
Definition: types_c.h:1436
Definition: ml.hpp:566
CvGaussBGStatModelParams params
Definition: legacy.hpp:3376
int * ne
Definition: legacy.hpp:316
const CvArr CvArr CvArr * disparityRight
Definition: legacy.hpp:3117
CvMat * matrix
Definition: legacy.hpp:1648
Definition: legacy.hpp:3193
Definition: ml.hpp:572
Definition: legacy.hpp:961
Definition: legacy.hpp:984
CvCallback callback
Definition: legacy.hpp:67
int width
Definition: types_c.h:1140
int m_pose_count
Definition: legacy.hpp:2350
Definition: features2d.hpp:205
CvArr CvArr * rectMapY
Definition: legacy.hpp:592
CvArr int CvScalar param1
Definition: core_c.h:649
int Read(int fd, void *buf, unsigned int count)
Definition: ts_gtest.h:2941
void int int uchar void * userData
Definition: legacy.hpp:78
CvImgObsInfo Cv1DObsInfo
Definition: legacy.hpp:118
float * cand_weight
Definition: legacy.hpp:329
const CvMat CvMat CvMat int k
Definition: legacy.hpp:3052
CvMat * m_pca_hr_eigenvectors
Definition: legacy.hpp:2531
CvSize img_size
Definition: legacy.hpp:1088
GLenum GLint x
Definition: core_c.h:632
CV_FACE_ELEMENTS
Definition: legacy.hpp:860
CvMat * grayImg
Definition: legacy.hpp:1319
Definition: legacy.hpp:3295
CvBGCodeBookElem ** cbmap
Definition: legacy.hpp:3406
CvAffinePose * m_affine_poses
Definition: legacy.hpp:2356
float T
Definition: legacy.hpp:3285
uchar int uchar int uchar * dst_pix
Definition: legacy.hpp:1133
int measure_params
Definition: legacy.hpp:1177
float K
Definition: legacy.hpp:3098
Definition: legacy.hpp:1044
int step() const
Definition: legacy.hpp:1459
GLintptr offset
void CvArr
Definition: types_c.h:196
GLuint GLuint GLsizei count
Definition: core_c.h:973
void SetPCADimLow(int pca_dim_low)
Definition: legacy.hpp:2342
struct CvBGCodeBookElem * next
Definition: legacy.hpp:3390
int etalonParamCount
Definition: legacy.hpp:1314
BaseKeypoint(int _x, int _y, IplImage *_image)
Definition: legacy.hpp:2015
const vector< KeyPoint > & GetLabeledFeatures() const
Definition: legacy.hpp:2586
void void int int void CvTermCriteria IplImage float * eigVals
Definition: legacy.hpp:84
int step() const
Definition: legacy.hpp:1627
const Cv3dTrackerCameraIntrinsics camera_intrinsics[]
Definition: legacy.hpp:936
float get_length() const
Definition: legacy.hpp:1665
GLenum GLsizei n
CvBool valid
Definition: legacy.hpp:922
IplImage * Fbd
Definition: legacy.hpp:3317
struct CvFileStorage CvFileStorage
Definition: types_c.h:1740
struct _IplROI * roi
Definition: types_c.h:483
CvMat CvMat * sample
Definition: ml.hpp:1985
The Image Processing.
GLdouble left
Definition: types_c.h:482
CvRect int int numberOfDisparities
Definition: calib3d.hpp:356
const CvArr int CvArr int maxDisparity
Definition: legacy.hpp:470
CvMat * ptrRight
Definition: legacy.hpp:3109
Definition: types_c.h:1828
Informative template class for OpenCV "scalars".
Definition: core.hpp:1006
CvBGPixelStat * pixel_stat
Definition: legacy.hpp:3315
IplImage * image
Definition: legacy.hpp:2009
void show()
GLuint GLsizei GLsizei * length
float ** flNewSamples
Definition: legacy.hpp:1167
Params params
Definition: legacy.hpp:2684
bool set_window(CvRect window)
Definition: legacy.hpp:1688
The Patch Generator class.
Definition: legacy.hpp:1845
OneWayDescriptorMatcher OneWayDescriptorMatch
Definition: legacy.hpp:2618
int CvSeq float CvSize2D32f int flag
Definition: legacy.hpp:237
int CvSeq float CvSize2D32f int CvPoint3D32f CvMemStorage CvSeq ** numbers
Definition: legacy.hpp:237
int needSwapCameras
Definition: legacy.hpp:528
Definition: ml.hpp:566
uchar * data()
Definition: legacy.hpp:1457
CvGaussBGPoint * g_point
Definition: legacy.hpp:3377
Definition: legacy.hpp:2824
void int double double theta
Definition: imgproc_c.h:603
float get_width() const
Definition: legacy.hpp:1667
IplImage * m_mask
Definition: legacy.hpp:1741
CvImage clone()
Definition: legacy.hpp:1384
int nOctaves
Definition: legacy.hpp:1894
struct CvBGCodeBookModel CvBGCodeBookModel
int nclasses
Definition: legacy.hpp:2711
OneWayDescriptor * m_pca_descriptors
Definition: legacy.hpp:2532
virtual const void * vector_lookup(int i)=0
int signatureSize
Definition: legacy.hpp:2713
int obs_x
Definition: legacy.hpp:108
Definition: types_c.h:645
CvMatrix(int _rows, int _cols, int _type)
Definition: legacy.hpp:1514
const GLdouble * v
CvMat * m_pca_eigenvectors
Definition: legacy.hpp:2529
Definition: legacy.hpp:768
struct CvStereoCamera CvStereoCamera
XML/YAML File Storage Class.
Definition: core.hpp:4040
string filename
Definition: legacy.hpp:2720
int compressionMethod
Definition: legacy.hpp:1990
void getFloatSignature(IplImage *patch, float *sig) const
Definition: legacy.hpp:2166
LDetector ldetector
Definition: legacy.hpp:2880
int CvSize CvPoint2D32f * imagePoints1
Definition: legacy.hpp:581
struct CvVoronoiDiagram2D CvVoronoiDiagram2D
Definition: legacy.hpp:1159
GLdouble GLdouble right
Definition: legacy.hpp:120
const Cv3dTrackerCameraIntrinsics CvSize float IplImage Cv3dTrackerCameraInfo camera_info[]
Definition: legacy.hpp:936
int index1
Definition: legacy.hpp:1049
double * transVect1
Definition: legacy.hpp:563
struct Cv3dTrackerCameraIntrinsics Cv3dTrackerCameraIntrinsics
void reset_roi()
Definition: legacy.hpp:1451
int * s
Definition: legacy.hpp:320
CvPoint3D32f float float * homography
Definition: legacy.hpp:251
float Pv
Definition: legacy.hpp:3297
CvSubdiv2DPointLocation
Definition: types_c.h:489
void discardFloatPosteriors()
Definition: legacy.hpp:2060
CvPoint2D32f p
Definition: legacy.hpp:895
Params params
Definition: legacy.hpp:2750
GLboolean GLboolean GLboolean b
Definition: legacy.hpp:633
The n-dimensional matrix class.
Definition: core.hpp:1688
int int int int int * first_corr
Definition: legacy.hpp:1115
int rows
Definition: core_c.h:114
struct Cv3dTrackerCameraInfo Cv3dTrackerCameraInfo
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
Definition: legacy.hpp:631
CvSeq * cvCalcContoursCorrespondence(const CvSeq *contour1, const CvSeq *contour2, CvMemStorage *storage)
CvConnectedComp m_comp
Definition: legacy.hpp:1729
Definition: legacy.hpp:892
vector< float > posteriors
Definition: legacy.hpp:1995
float phi
Definition: legacy.hpp:2211
CvSeq * cvPostBoostingFindFace(IplImage *Image, CvMemStorage *storage)
double get_log_likelihood() const
Definition: legacy.hpp:1817
CvMemStorage CvTermCriteria criteria
Definition: legacy.hpp:764
int maxIters
Definition: legacy.hpp:3102
double backgroundMin
Definition: legacy.hpp:1864
Definition: types_c.h:465
Template matrix class derived from Mat.
Definition: core.hpp:115
Definition: legacy.hpp:2892
CvImage(const char *filename, const char *imgname=0, int color=-1)
Definition: legacy.hpp:1366
short offset2
Definition: legacy.hpp:2123
CV_INLINE CvSubdiv2DEdge cvSubdiv2DNextEdge(CvSubdiv2DEdge edge)
Definition: legacy.hpp:2972
Definition: types_c.h:997
CvSize size() const
Definition: legacy.hpp:1615
int pix_size() const
Definition: legacy.hpp:1455
int depth() const
Definition: legacy.hpp:1453
Definition: legacy.hpp:1655
int CvSize CvPoint2D32f CvPoint2D32f CvPoint3D32f * objectPoints
Definition: legacy.hpp:581
uchar * first_pix
Definition: legacy.hpp:1133
const CvArr CvSeq CvSeq ** descriptors
Definition: compat.hpp:647
CvPoint2D32f p1_end
Definition: legacy.hpp:577
const CvArr * rightImage
Definition: legacy.hpp:470
double weight
Definition: legacy.hpp:3362
uchar int uchar int uchar int * dst_num
Definition: legacy.hpp:1133
struct CvBGPixelStat CvBGPixelStat
Definition: legacy.hpp:3399
CvPoint2D64f CvPoint2D64f CvPoint2D64f p2_end
Definition: legacy.hpp:663
CvSize CvPoint2D32f * corners
Definition: calib3d.hpp:215
virtual ~BruteForceMatcher()
Definition: legacy.hpp:2828
GLuint GLuint end
OutputArray OutputArray labels
Definition: imgproc.hpp:823
CV_INLINE double icvSqDist2D32f(CvPoint2D32f pt1, CvPoint2D32f pt2)
Definition: legacy.hpp:3021
RTreeNode()
Definition: legacy.hpp:2125
void release()
Definition: legacy.hpp:1579
float * transP
Definition: legacy.hpp:134
float get_orientation() const
Definition: legacy.hpp:1663
Definition: legacy.hpp:967
CvPoint2D32f * cameraPoint
Definition: legacy.hpp:547
CvGraphWeightType
Definition: legacy.hpp:278
int GetLowPCA(CvMat **avg, CvMat **eigenvectors)
Definition: legacy.hpp:2506
int perform_morphing
Definition: legacy.hpp:3277
const char * window_name
Definition: highgui_c.h:149
bool verbose
Definition: legacy.hpp:1896
int cols
Definition: core_c.h:109
int SamplesNum
Definition: legacy.hpp:1165
Window window
Definition: tracking.hpp:154
Definition: legacy.hpp:1005
Definition: legacy.hpp:2621
CV_INLINE Cv3dTrackerTrackedObject cv3dTrackerTrackedObject(int id, CvPoint3D32f p)
Definition: legacy.hpp:912
GLfloat GLfloat p
GLuint GLuint GLsizei GLenum type
Definition: core_c.h:114
CvArr * rectMapX
Definition: legacy.hpp:592
void void * frame
Definition: core_c.h:1459
GLenum const GLfloat * params
Definition: compat.hpp:688
const CvContourTree * tree2
Definition: legacy.hpp:771
__int64 int64
Definition: types_c.h:158
GLsizei samples
int m_object_feature_count
Definition: legacy.hpp:2610
int height() const
Definition: legacy.hpp:1429
const GLubyte * c
Definition: legacy.hpp:633
virtual IplImage * get_back_project()
Definition: legacy.hpp:1715
CvPoint3D64f CvPoint3D64f CvPoint3D64f * pointSym2
Definition: legacy.hpp:552
RTreeClassifier classifier_
Definition: legacy.hpp:2775
const CvPoint2D32f double CvArr * rectMap
Definition: legacy.hpp:1070
CvSize roi_size() const
Definition: legacy.hpp:1433
CvPoint pt1
Definition: core_c.h:1270
CvLeeParameters
Definition: legacy.hpp:959
Definition: legacy.hpp:1766
int int channel
int int int int int int h
int maxIters
Definition: legacy.hpp:3114
float transVect[3]
Definition: legacy.hpp:511
GLuint const GLchar * name
Definition: core_c.h:1546
int structSize
Definition: legacy.hpp:1987
virtual void computeImpl(const Mat &image, vector< KeyPoint > &keypoints, Mat &descriptors) const
Definition: legacy.hpp:2786
struct CvGaussBGStatModelParams CvGaussBGStatModelParams
CvBox2D m_box
Definition: legacy.hpp:1728
Definition: types_c.h:1173
Definition: ml.hpp:572
int best_score
Definition: legacy.hpp:322
virtual void hash_remove(lsh_hash h, int l, int i)=0
Definition: legacy.hpp:1969
int etalonPointCount
Definition: legacy.hpp:1316
float * flConfidence
Definition: legacy.hpp:1168
vector< KeyPoint > modelPoints
Definition: legacy.hpp:2879
double double double double double double CvSize * warpSize
Definition: legacy.hpp:680
double double double double double double CvSize double quad1[4][2]
Definition: legacy.hpp:680
float distortion[4]
Definition: legacy.hpp:508
float egvects[4]
Definition: legacy.hpp:537
string trainPath
Definition: legacy.hpp:2644
bool set_max_ch_val(int channel, int val)
Definition: legacy.hpp:1700
double YcoefA
Definition: legacy.hpp:493
CvPoint2D32f CvPoint2D32f CvPoint2D32f CvPoint2D32f * cross
Definition: legacy.hpp:577
float y
Definition: types_c.h:1043
int original_num_classes() const
Definition: legacy.hpp:2173
CvImage()
Definition: legacy.hpp:1349
double * etalonParams
Definition: legacy.hpp:1315
int channels() const
Definition: legacy.hpp:1622
const CvArr CvSize win_size
Definition: legacy.hpp:3123
CvMatrix(CvFileStorage *fs, const char *seqname, int idx)
Definition: legacy.hpp:1542
CvRect MouthRect
Definition: legacy.hpp:877
uchar uchar int int int int int int * num_runs2
Definition: legacy.hpp:1104
CvMemStorage int method CV_DEFAULT(CV_DOMINANT_IPAN)
int h1
Definition: legacy.hpp:2889
uchar modMax[3]
Definition: legacy.hpp:3405
CvMatrix(CvMat *m)
Definition: legacy.hpp:1527
float CvSize dctSize
Definition: legacy.hpp:191
float scale_max
Definition: legacy.hpp:2545
CvSize int int * scanlines2
Definition: legacy.hpp:1088
CvRect window
Definition: tracking.hpp:148
float query(int *bin) const
Definition: legacy.hpp:1718
int int descriptor
Definition: legacy.hpp:845
Definition: legacy.hpp:3373
GLboolean GLboolean GLboolean GLboolean a
Definition: legacy.hpp:633
Definition: legacy.hpp:1967
CV_WRAP double getLikelihood() const
Definition: legacy.hpp:1807
CvMat ** GetPCACoeffs() const
Definition: legacy.hpp:2347
CvPoint3D64f pointB
Definition: legacy.hpp:616
void SetPCADimHigh(int pca_dim_high)
Definition: legacy.hpp:2341
int int int quadedge_size
Definition: legacy.hpp:2930
float * weight
Definition: legacy.hpp:126
void set_coi(int _coi)
Definition: legacy.hpp:1452
float Pbcc
Definition: legacy.hpp:3304
Definition: legacy.hpp:875
CvPoint3D32f epipole[2]
Definition: legacy.hpp:521
CvSize size() const
Definition: legacy.hpp:1431
int int int * dx
Definition: ml.hpp:134
virtual void clear()
int const Cv3dTrackerCameraInfo const Cv3dTracker2dTrackedObject tracking_info[]
Definition: legacy.hpp:942
Definition: legacy.hpp:2020
Definition: legacy.hpp:963
CvMat * right
Definition: legacy.hpp:3105
CvEMParams EMParams
Definition: legacy.hpp:1839
CV_PROP_RW int cov_mat_type
Definition: legacy.hpp:1756
uchar uchar int * line_lengths1
Definition: legacy.hpp:1104
CV_PROP_RW int nclusters
Definition: legacy.hpp:1755
int level
Definition: legacy.hpp:132
int step
Definition: legacy.hpp:845
int stale
Definition: legacy.hpp:3392
CvImage(IplImage *img)
Definition: legacy.hpp:1356
float Pvb
Definition: legacy.hpp:3297
Definition: legacy.hpp:3351
uchar * row(int i)
Definition: legacy.hpp:1632
void int int ioBufSize
Definition: legacy.hpp:78
int num_objects
Definition: legacy.hpp:942
IplImage * img
Definition: legacy.hpp:1096
float distortion[4]
Definition: legacy.hpp:932
void create(int rows, int cols, int type)
allocates new matrix data unless the matrix already has specified size and type.
Definition: mat.hpp:347
CV_INLINE CvSubdiv2DEdge cvSubdiv2DRotateEdge(CvSubdiv2DEdge edge, int rotate)
Definition: legacy.hpp:2978
float rotMatr[9]
Definition: legacy.hpp:510
IplImage * Ftd
Definition: legacy.hpp:3316
CvMat ** m_transforms
Definition: legacy.hpp:2538
bool is_valid()
Definition: legacy.hpp:1610
CvPoint int float float * beta
Definition: legacy.hpp:798
CvMatrix clone()
Definition: legacy.hpp:1550
struct CvVoronoiNode2D CvVoronoiNode2D
CvArr int CvScalar CvScalar param2
Definition: core_c.h:649
int * current_comp
Definition: legacy.hpp:313
int double * average
Definition: legacy.hpp:847
int GetDescriptorCount() const
Definition: legacy.hpp:2409
string trainImagesList
Definition: legacy.hpp:2645
CvGraph * graph
Definition: legacy.hpp:307
CvArr * arr
Definition: core_c.h:649
_Tp y
Definition: core.hpp:766
uchar int uchar int * second_num
Definition: legacy.hpp:1133
void * mog
Definition: legacy.hpp:3379
CvBGPixelCCStatTable * cctable
Definition: legacy.hpp:3306
Definition: legacy.hpp:280
void int int uchar void IplImage float * covarMatrix
Definition: legacy.hpp:78
Definition: legacy.hpp:2121
unsigned char uchar
Definition: types_c.h:170
int int int * second
Definition: legacy.hpp:1115
IplImage CvMemStorage CvSeq int double threshold1
Definition: legacy.hpp:2917
int MP
Definition: legacy.hpp:1161
const CvArr CvSize CvArr * velx
Definition: legacy.hpp:3123
Definition: types_c.h:1333
int nViews
Definition: legacy.hpp:1895
const CvMat ** covs
Definition: legacy.hpp:1761
int minDisparity
Definition: legacy.hpp:3100
virtual int hash_lookup(lsh_hash h, int l, int *ret_i, int ret_i_max)=0
GLuint dst
Definition: calib3d.hpp:134
double double double double double double CvSize double double double CvPoint3D64f * epipole1
Definition: legacy.hpp:680
int * nod
Definition: legacy.hpp:319
IplImage CvRect int CvPoint * ptRotate
Definition: legacy.hpp:869
CvStereoLineCoeff * lineCoeffs
Definition: legacy.hpp:527
const CvArr CvArr CvArr CvStereoGCState * state
Definition: legacy.hpp:3117
struct Cv3dTrackerTrackedObject Cv3dTrackerTrackedObject
float transVector[3]
Definition: legacy.hpp:530
void * parent
Definition: core_c.h:1459
::max::max::max float
Definition: functional.hpp:326
CvPoint2D32f get_center() const
Definition: legacy.hpp:1669
uchar boxMin[3]
Definition: legacy.hpp:3393
virtual bool empty() const
Definition: legacy.hpp:2521
int stepMagnitude
Definition: legacy.hpp:834
false
Definition: color.hpp:230
float * Temp
Definition: legacy.hpp:1170
void release()
Definition: legacy.hpp:1394
struct CvGraphWeightedVtx CvGraphWeightedVtx
::max::max int
Definition: functional.hpp:324
CvSize warpSize
Definition: legacy.hpp:526
CvArr double canny_threshold
Definition: legacy.hpp:55
Definition: legacy.hpp:282
int m_pca_dim_high
Definition: legacy.hpp:2362
int const Cv3dTrackerCameraInfo const Cv3dTracker2dTrackedObject Cv3dTrackerTrackedObject tracked_objects[]
Definition: legacy.hpp:942
Definition: legacy.hpp:1747
Definition: legacy.hpp:965
IplImage * m_input_patch
Definition: legacy.hpp:2353
IplImage * curr_frame
Definition: legacy.hpp:3216
struct CvGaussBGPoint CvGaussBGPoint
GLsizei const GLfloat * points
CvMat * covs[]
Definition: ml.hpp:1990
CvMat * ptrLeft
Definition: legacy.hpp:3108
const IplImage * imgGray
Definition: legacy.hpp:867
virtual void write(FileStorage &fs) const
Definition: legacy.hpp:2811
CV_INLINE Cv3dTracker2dTrackedObject cv3dTracker2dTrackedObject(int id, CvPoint2D32f p)
Definition: legacy.hpp:898
const uchar * row(int i) const
Definition: legacy.hpp:1633
Definition: types_c.h:1075
Smart pointer to dynamically allocated objects.
Definition: core.hpp:1268
Definition: legacy.hpp:1968
CvPoint2D64f CvPoint2D64f p2_start
Definition: legacy.hpp:663
CvMat * m_pca_hr_avg
Definition: legacy.hpp:2530
int leavesPerStruct
Definition: legacy.hpp:1991
double phiMin
Definition: legacy.hpp:1869
double variance[CV_BGFG_MOG_NCOLORS]
Definition: legacy.hpp:3363
CvPoint m_center
Definition: legacy.hpp:2360
CvPoint2D64f CvPoint2D64f CvPoint2D64f point4
Definition: legacy.hpp:595
Definition: legacy.hpp:966
Definition: legacy.hpp:3312
CvMat * lower_bound
Definition: legacy.hpp:1187
const GLfloat * m
Definition: legacy.hpp:2624
Definition: legacy.hpp:962
bool set_threshold(int threshold)
Definition: legacy.hpp:1691
float maxWidth
Definition: legacy.hpp:1062
int get_max_ch_val(int channel) const
Definition: legacy.hpp:1684
int is_obj_without_holes
Definition: legacy.hpp:3276
float x
Definition: types_c.h:1042
CvSize int int int * lengths1
Definition: legacy.hpp:1088
double * camMatr
Definition: legacy.hpp:608
CvBGCodeBookElem * freeList
Definition: legacy.hpp:3408
int rows() const
Definition: legacy.hpp:1612
typedef void(CV_CDECL *CvReleaseBGStatModel)(struct CvBGStatModel **bg_model)
const CvMat * probs
Definition: legacy.hpp:1758
int CvSeq float CvSize2D32f int jc
Definition: legacy.hpp:244
CV_VORONOISITE2D_FIELDS() struct CvVoronoiSite2D *next[2]
double logLikelihood
Definition: legacy.hpp:1827
MSize size
Definition: core.hpp:2006
const uchar * data() const
Definition: legacy.hpp:1458
GLint GLint GLsizei GLsizei GLsizei depth
Definition: core_c.h:76
float focal_length[2]
Definition: legacy.hpp:931
CvPoint3D64f CvPoint3D64f pointCam1
Definition: legacy.hpp:616
Definition: types_c.h:1040
IplImage * m_back_project
Definition: legacy.hpp:1739
int framesAccepted
Definition: legacy.hpp:1339
float lambda2
Definition: legacy.hpp:3098
int tLastUpdate
Definition: legacy.hpp:3391
GLenum GLenum GLenum GLenum GLenum scale
Rect modelROI
Definition: legacy.hpp:2878
double Ycoef
Definition: legacy.hpp:492
CV_INLINE CvSubdiv2DEdge cvSubdiv2DSymEdge(CvSubdiv2DEdge edge)
Definition: legacy.hpp:2983
int GetPCADimLow() const
Definition: legacy.hpp:2513
double baseFeatureSize
Definition: legacy.hpp:1898
void SetLabeledFeatures(const vector< KeyPoint > &features)
Definition: legacy.hpp:2584
int numberOfDisparities
Definition: legacy.hpp:3101
Ptr< FernClassifier > classifier
Definition: legacy.hpp:2749
void set_roi(CvRect _roi)
Definition: legacy.hpp:1450
int m_pca_dim_low
Definition: legacy.hpp:2541
CvPoint3D64f point1
Definition: legacy.hpp:552
struct CvBGStatModel CvBGStatModel
CvSeq ** ContourSeq
Definition: legacy.hpp:1029
CvMat * m_pca_avg
Definition: legacy.hpp:2528
float lambda1
Definition: legacy.hpp:2213
CvPoint2D32f quad[2][4]
Definition: legacy.hpp:522
float * obs
Definition: legacy.hpp:111
void clear()
Definition: legacy.hpp:1395
GLenum GLint GLuint mask
Definition: tracking.hpp:132
CvPoint3D64f CvPoint3D64f double gamma
Definition: legacy.hpp:616
int int * first_runs
Definition: legacy.hpp:1115
int id
Definition: legacy.hpp:908
CvStereoCamera stereo
Definition: legacy.hpp:1326
CvCamera * camera[2]
Definition: legacy.hpp:517
float * log_var_val
Definition: legacy.hpp:125
CvPoint3D64f double double * transVect
Definition: legacy.hpp:570
GLclampf f
CvMatrix(const char *filename, const char *matname=0, int color=-1)
Definition: legacy.hpp:1536
const IplImage CvRect * pRects
Definition: legacy.hpp:867
GLsizei maxCount
IplImage * image
Definition: legacy.hpp:1505
uchar * prewarp1
Definition: legacy.hpp:1104
GLint GLint GLsizei GLsizei GLsizei GLint border
struct CvFGDStatModelParams CvFGDStatModelParams
Definition: types_c.h:468
void create(int _rows, int _cols, int _type)
Definition: legacy.hpp:1560
static string GetPCAFilename()
Definition: legacy.hpp:2519
CvLatentSvmDetector * detector
Definition: objdetect.hpp:270
double Xcoef
Definition: legacy.hpp:487
CvMemStorage * storage
Definition: legacy.hpp:3407
RTreeNode(uchar x1, uchar y1, uchar x2, uchar y2)
Definition: legacy.hpp:2126
int coi() const
Definition: legacy.hpp:1448
CvMat * dispLeft
Definition: legacy.hpp:3106
struct CvGraphWeightedEdge CvGraphWeightedEdge
uchar y2
Definition: legacy.hpp:1956
CvPoint2D64f double * normDirect
Definition: legacy.hpp:709
int compressionMethod
Definition: legacy.hpp:2717
static float GET_MIN_SCALE()
Definition: legacy.hpp:2630
CvArr * fieldEven
Definition: legacy.hpp:721
int origin() const
Definition: legacy.hpp:1460
GLsizeiptr size
Definition: core_c.h:939
double XcoefB
Definition: legacy.hpp:489
struct CvConDensation CvConDensation
int interactionRadius
Definition: legacy.hpp:3097
virtual bool empty() const
Definition: legacy.hpp:2815
CvPoint3D64f double * dist
Definition: legacy.hpp:556
int * mix
Definition: legacy.hpp:114
int index2
Definition: legacy.hpp:1050
Definition: types_c.h:1115
int weighted_edges
Definition: legacy.hpp:324
double variance_init
Definition: legacy.hpp:3356
CV_INLINE CvRect cvRect(int x, int y, int width, int height)
Definition: types_c.h:960
double bg_threshold
Definition: legacy.hpp:3355
struct CvBGCodeBookElem CvBGCodeBookElem
double weight_init
Definition: legacy.hpp:3356
int Ithreshold
Definition: legacy.hpp:3096
int patchSize
Definition: legacy.hpp:2712
CalonderDescriptorExtractor(const string &classifierFile)
Definition: legacy.hpp:2780
int GetPoseCount() const
Definition: legacy.hpp:2403
vector< RandomizedTree > trees_
Definition: legacy.hpp:2189
CV_EXPORTS void rotate(const GpuMat &src, GpuMat &dst, Size dsize, double angle, double xShift=0, double yShift=0, int interpolation=INTER_LINEAR, Stream &stream=Stream::Null())
struct CvMatrix3 CvMatrix3
int CvSize CvPoint2D32f CvPoint2D32f CvPoint3D32f CvStereoCamera * stereoparams
Definition: legacy.hpp:581
CvSize imgSize
Definition: legacy.hpp:1318
CvPoint2D32f * etalonPoints
Definition: legacy.hpp:1317
CvSize int int int int * lengths2
Definition: legacy.hpp:1088
Rect_< int > Rect
Definition: core.hpp:897
int int sample_count
Definition: legacy.hpp:1177
Definition: legacy.hpp:862
int nclasses
Definition: legacy.hpp:1988
FernDescriptorMatcher FernDescriptorMatch
Definition: legacy.hpp:2691
~CvMatrix()
Definition: legacy.hpp:1545
virtual unsigned int vector_count()=0
const CvArr * next
Definition: tracking.hpp:102
CvFGDStatModelParams params
Definition: legacy.hpp:3319
CvMemStorage CvSeq ** labels
Definition: core_c.h:1083
void applyQuantization(int num_quant_bits)
Definition: legacy.hpp:2062
struct CvFace CvFaceData
double double * max_val
Definition: core_c.h:833
Definition: legacy.hpp:283
int depth()
Definition: legacy.hpp:2057
virtual void vector_reserve(int n)=0
int structSize
Definition: legacy.hpp:2715
uchar * roi_row(int y)
Definition: legacy.hpp:1462
bool is_valid()
Definition: legacy.hpp:1426
int threshold
Definition: legacy.hpp:1893
short float uchar uchar uchar uchar uchar ushort int uchar ushort int float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float int int int float int int int float int CV_CUDEV_IMPLEMENT_VEC_BINARY_OP char CV_CUDEV_IMPLEMENT_VEC_BINARY_OP ushort CV_CUDEV_IMPLEMENT_VEC_BINARY_OP short CV_CUDEV_IMPLEMENT_VEC_BINARY_OP int CV_CUDEV_IMPLEMENT_VEC_BINARY_OP uint CV_CUDEV_IMPLEMENT_VEC_BINARY_OP float CV_CUDEV_IMPLEMENT_VEC_BINARY_OP double int int uint double
Definition: vec_math.hpp:432
CvMatrix(int _rows, int _cols, int _type, CvMat *hdr, void *_data=0, int _step=CV_AUTOSTEP)
Definition: legacy.hpp:1517
CvMat ** m_pca_coeffs
Definition: legacy.hpp:2355
CvArr CvArr * fieldOdd
Definition: legacy.hpp:721
float CvSize CvSize CvSize delta
Definition: legacy.hpp:191
const CvArr CvArr * disparityLeft
Definition: legacy.hpp:3117
double * direct2
Definition: legacy.hpp:656
uchar learnMax[3]
Definition: legacy.hpp:3396
Definition: legacy.hpp:534
float * vertex_weights
Definition: legacy.hpp:327
Definition: types_c.h:1096
double mean[CV_BGFG_MOG_NCOLORS]
Definition: legacy.hpp:3364
double YcoefB
Definition: legacy.hpp:494
uchar is_trained_dyn_model
Definition: legacy.hpp:3308
GLuint color
Definition: core_c.h:1276
vector< KeyPoint > m_train_features
Definition: legacy.hpp:2609