root / branches / test / PS3Capture / Include / opencv2 / legacy / compat.hpp @ 6

View | Annotate | Download (25.8 KB)

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
/*
43
   A few macros and definitions for backward compatibility
44
   with the previous versions of OpenCV. They are obsolete and
45
   are likely to be removed in future. To check whether your code
46
   uses any of these, define CV_NO_BACKWARD_COMPATIBILITY before
47
   including cv.h.
48
*/
49
50
#ifndef __OPENCV_COMPAT_HPP__
51
#define __OPENCV_COMPAT_HPP__
52
53
#include "opencv2/core/core_c.h"
54
#include "opencv2/imgproc/types_c.h"
55
56
#include <math.h>
57
#include <string.h>
58
59
#ifdef __cplusplus
60
extern "C" {
61
#endif
62
63
typedef int CvMatType;
64
typedef int CvDisMaskType;
65
typedef CvMat CvMatArray;
66
67
typedef int CvThreshType;
68
typedef int CvAdaptiveThreshMethod;
69
typedef int CvCompareMethod;
70
typedef int CvFontFace;
71
typedef int CvPolyApproxMethod;
72
typedef int CvContoursMatchMethod;
73
typedef int CvContourTreesMatchMethod;
74
typedef int CvCoeffType;
75
typedef int CvRodriguesType;
76
typedef int CvElementShape;
77
typedef int CvMorphOp;
78
typedef int CvTemplMatchMethod;
79
80
typedef CvPoint2D64f CvPoint2D64d;
81
typedef CvPoint3D64f CvPoint3D64d;
82
83
enum
84
{
85
    CV_MAT32F      = CV_32FC1,
86
    CV_MAT3x1_32F  = CV_32FC1,
87
    CV_MAT4x1_32F  = CV_32FC1,
88
    CV_MAT3x3_32F  = CV_32FC1,
89
    CV_MAT4x4_32F  = CV_32FC1,
90
91
    CV_MAT64D      = CV_64FC1,
92
    CV_MAT3x1_64D  = CV_64FC1,
93
    CV_MAT4x1_64D  = CV_64FC1,
94
    CV_MAT3x3_64D  = CV_64FC1,
95
    CV_MAT4x4_64D  = CV_64FC1
96
};
97
98
enum
99
{
100
    IPL_GAUSSIAN_5x5 = 7
101
};
102
103
typedef CvBox2D  CvBox2D32f;
104
105
/* allocation/deallocation macros */
106
#define cvCreateImageData   cvCreateData
107
#define cvReleaseImageData  cvReleaseData
108
#define cvSetImageData      cvSetData
109
#define cvGetImageRawData   cvGetRawData
110
111
#define cvmAlloc            cvCreateData
112
#define cvmFree             cvReleaseData
113
#define cvmAllocArray       cvCreateData
114
#define cvmFreeArray        cvReleaseData
115
116
#define cvIntegralImage     cvIntegral
117
#define cvMatchContours     cvMatchShapes
118
119
CV_EXPORTS CvMat cvMatArray( int rows, int cols, int type,
120
                            int count, void* data CV_DEFAULT(0));
121
122
#define cvUpdateMHIByTime  cvUpdateMotionHistory
123
124
#define cvAccMask cvAcc
125
#define cvSquareAccMask cvSquareAcc
126
#define cvMultiplyAccMask cvMultiplyAcc
127
#define cvRunningAvgMask(imgY, imgU, mask, alpha) cvRunningAvg(imgY, imgU, alpha, mask)
128
129
#define cvSetHistThresh  cvSetHistBinRanges
130
#define cvCalcHistMask(img, mask, hist, doNotClear) cvCalcHist(img, hist, doNotClear, mask)
131
132
CV_EXPORTS double cvMean( const CvArr* image, const CvArr* mask CV_DEFAULT(0));
133
CV_EXPORTS double cvSumPixels( const CvArr* image );
134
CV_EXPORTS void  cvMean_StdDev( const CvArr* image, double* mean, double* sdv,
135
                                const CvArr* mask CV_DEFAULT(0));
136
137
CV_EXPORTS void cvmPerspectiveProject( const CvMat* mat, const CvArr* src, CvArr* dst );
138
CV_EXPORTS void cvFillImage( CvArr* mat, double color );
139
140
#define cvCvtPixToPlane cvSplit
141
#define cvCvtPlaneToPix cvMerge
142
143
typedef struct CvRandState
144
{
145
    CvRNG     state;    /* RNG state (the current seed and carry)*/
146
    int       disttype; /* distribution type */
147
    CvScalar  param[2]; /* parameters of RNG */
148
} CvRandState;
149
150
/* Changes RNG range while preserving RNG state */
151
CV_EXPORTS void  cvRandSetRange( CvRandState* state, double param1,
152
                                 double param2, int index CV_DEFAULT(-1));
153
154
CV_EXPORTS void  cvRandInit( CvRandState* state, double param1,
155
                             double param2, int seed,
156
                             int disttype CV_DEFAULT(CV_RAND_UNI));
157
158
/* Fills array with random numbers */
159
CV_EXPORTS void cvRand( CvRandState* state, CvArr* arr );
160
161
#define cvRandNext( _state ) cvRandInt( &(_state)->state )
162
163
CV_EXPORTS void cvbRand( CvRandState* state, float* dst, int len );
164
165
CV_EXPORTS void  cvbCartToPolar( const float* y, const float* x,
166
                                 float* magnitude, float* angle, int len );
167
CV_EXPORTS void  cvbFastArctan( const float* y, const float* x, float* angle, int len );
168
CV_EXPORTS void  cvbSqrt( const float* x, float* y, int len );
169
CV_EXPORTS void  cvbInvSqrt( const float* x, float* y, int len );
170
CV_EXPORTS void  cvbReciprocal( const float* x, float* y, int len );
171
CV_EXPORTS void  cvbFastExp( const float* x, double* y, int len );
172
CV_EXPORTS void  cvbFastLog( const double* x, float* y, int len );
173
174
CV_EXPORTS CvRect  cvContourBoundingRect( void* point_set, int update CV_DEFAULT(0));
175
176
CV_EXPORTS double cvPseudoInverse( const CvArr* src, CvArr* dst );
177
#define cvPseudoInv cvPseudoInverse
178
179
#define cvContourMoments( contour, moments ) cvMoments( contour, moments, 0 )
180
181
#define cvGetPtrAt              cvPtr2D
182
#define cvGetAt                 cvGet2D
183
#define cvSetAt(arr,val,y,x)    cvSet2D((arr),(y),(x),(val))
184
185
#define cvMeanMask  cvMean
186
#define cvMean_StdDevMask(img,mask,mean,sdv) cvMean_StdDev(img,mean,sdv,mask)
187
188
#define cvNormMask(imgA,imgB,mask,normType) cvNorm(imgA,imgB,normType,mask)
189
190
#define cvMinMaxLocMask(img, mask, min_val, max_val, min_loc, max_loc) \
191
        cvMinMaxLoc(img, min_val, max_val, min_loc, max_loc, mask)
192
193
#define cvRemoveMemoryManager  cvSetMemoryManager
194
195
#define cvmSetZero( mat )               cvSetZero( mat )
196
#define cvmSetIdentity( mat )           cvSetIdentity( mat )
197
#define cvmAdd( src1, src2, dst )       cvAdd( src1, src2, dst, 0 )
198
#define cvmSub( src1, src2, dst )       cvSub( src1, src2, dst, 0 )
199
#define cvmCopy( src, dst )             cvCopy( src, dst, 0 )
200
#define cvmMul( src1, src2, dst )       cvMatMulAdd( src1, src2, 0, dst )
201
#define cvmTranspose( src, dst )        cvT( src, dst )
202
#define cvmInvert( src, dst )           cvInv( src, dst )
203
#define cvmMahalanobis(vec1, vec2, mat) cvMahalanobis( vec1, vec2, mat )
204
#define cvmDotProduct( vec1, vec2 )     cvDotProduct( vec1, vec2 )
205
#define cvmCrossProduct(vec1, vec2,dst) cvCrossProduct( vec1, vec2, dst )
206
#define cvmTrace( mat )                 (cvTrace( mat )).val[0]
207
#define cvmMulTransposed( src, dst, order ) cvMulTransposed( src, dst, order )
208
#define cvmEigenVV( mat, evec, eval, eps)   cvEigenVV( mat, evec, eval, eps )
209
#define cvmDet( mat )                   cvDet( mat )
210
#define cvmScale( src, dst, scale )     cvScale( src, dst, scale )
211
212
#define cvCopyImage( src, dst )         cvCopy( src, dst, 0 )
213
#define cvReleaseMatHeader              cvReleaseMat
214
215
/* Calculates exact convex hull of 2d point set */
216
CV_EXPORTS void cvConvexHull( CvPoint* points, int num_points,
217
                             CvRect* bound_rect,
218
                             int orientation, int* hull, int* hullsize );
219
220
221
CV_EXPORTS void cvMinAreaRect( CvPoint* points, int n,
222
                              int left, int bottom,
223
                              int right, int top,
224
                              CvPoint2D32f* anchor,
225
                              CvPoint2D32f* vect1,
226
                              CvPoint2D32f* vect2 );
227
228
typedef int CvDisType;
229
typedef int CvChainApproxMethod;
230
typedef int CvContourRetrievalMode;
231
232
CV_EXPORTS  void  cvFitLine3D( CvPoint3D32f* points, int count, int dist,
233
                    void *param, float reps, float aeps, float* line );
234
235
/* Fits a line into set of 2d points in a robust way (M-estimator technique) */
236
CV_EXPORTS  void  cvFitLine2D( CvPoint2D32f* points, int count, int dist,
237
                    void *param, float reps, float aeps, float* line );
238
239
CV_EXPORTS  void  cvFitEllipse( const CvPoint2D32f* points, int count, CvBox2D* box );
240
241
/* Projects 2d points to one of standard coordinate planes
242
   (i.e. removes one of coordinates) */
243
CV_EXPORTS  void  cvProject3D( CvPoint3D32f* points3D, int count,
244
                              CvPoint2D32f* points2D,
245
                              int xIndx CV_DEFAULT(0),
246
                              int yIndx CV_DEFAULT(1));
247
248
/* Retrieves value of the particular bin
249
   of x-dimensional (x=1,2,3,...) histogram */
250
#define cvQueryHistValue_1D( hist, idx0 ) \
251
    ((float)cvGetReal1D( (hist)->bins, (idx0)))
252
#define cvQueryHistValue_2D( hist, idx0, idx1 ) \
253
    ((float)cvGetReal2D( (hist)->bins, (idx0), (idx1)))
254
#define cvQueryHistValue_3D( hist, idx0, idx1, idx2 ) \
255
    ((float)cvGetReal3D( (hist)->bins, (idx0), (idx1), (idx2)))
256
#define cvQueryHistValue_nD( hist, idx ) \
257
    ((float)cvGetRealND( (hist)->bins, (idx)))
258
259
/* Returns pointer to the particular bin of x-dimesional histogram.
260
   For sparse histogram the bin is created if it didn't exist before */
261
#define cvGetHistValue_1D( hist, idx0 ) \
262
    ((float*)cvPtr1D( (hist)->bins, (idx0), 0))
263
#define cvGetHistValue_2D( hist, idx0, idx1 ) \
264
    ((float*)cvPtr2D( (hist)->bins, (idx0), (idx1), 0))
265
#define cvGetHistValue_3D( hist, idx0, idx1, idx2 ) \
266
    ((float*)cvPtr3D( (hist)->bins, (idx0), (idx1), (idx2), 0))
267
#define cvGetHistValue_nD( hist, idx ) \
268
    ((float*)cvPtrND( (hist)->bins, (idx), 0))
269
270
271
#define CV_IS_SET_ELEM_EXISTS CV_IS_SET_ELEM
272
273
274
CV_EXPORTS  int  cvHoughLines( CvArr* image, double rho,
275
                              double theta, int threshold,
276
                              float* lines, int linesNumber );
277
278
CV_EXPORTS  int  cvHoughLinesP( CvArr* image, double rho,
279
                               double theta, int threshold,
280
                               int lineLength, int lineGap,
281
                               int* lines, int linesNumber );
282
283
284
CV_EXPORTS  int  cvHoughLinesSDiv( CvArr* image, double rho, int srn,
285
                                  double theta, int stn, int threshold,
286
                                  float* lines, int linesNumber );
287
288
CV_EXPORTS  float  cvCalcEMD( const float* signature1, int size1,
289
                             const float* signature2, int size2,
290
                             int dims, int dist_type CV_DEFAULT(CV_DIST_L2),
291
                             CvDistanceFunction dist_func CV_DEFAULT(0),
292
                             float* lower_bound CV_DEFAULT(0),
293
                             void* user_param CV_DEFAULT(0));
294
295
CV_EXPORTS  void  cvKMeans( int num_clusters, float** samples,
296
                           int num_samples, int vec_size,
297
                           CvTermCriteria termcrit, int* cluster_idx );
298
299
CV_EXPORTS void  cvStartScanGraph( CvGraph* graph, CvGraphScanner* scanner,
300
                                  CvGraphVtx* vtx CV_DEFAULT(NULL),
301
                                  int mask CV_DEFAULT(CV_GRAPH_ALL_ITEMS));
302
303
CV_EXPORTS  void  cvEndScanGraph( CvGraphScanner* scanner );
304
305
306
/* old drawing functions */
307
CV_EXPORTS void  cvLineAA( CvArr* img, CvPoint pt1, CvPoint pt2,
308
                            double color, int scale CV_DEFAULT(0));
309
310
CV_EXPORTS void  cvCircleAA( CvArr* img, CvPoint center, int radius,
311
                            double color, int scale CV_DEFAULT(0) );
312
313
CV_EXPORTS void  cvEllipseAA( CvArr* img, CvPoint center, CvSize axes,
314
                              double angle, double start_angle,
315
                              double end_angle, double color,
316
                              int scale CV_DEFAULT(0) );
317
318
CV_EXPORTS void  cvPolyLineAA( CvArr* img, CvPoint** pts, int* npts, int contours,
319
                              int is_closed, double color, int scale CV_DEFAULT(0) );
320
321
/****************************************************************************************\
322
*                                   Pixel Access Macros                                  *
323
\****************************************************************************************/
324
325
typedef struct _CvPixelPosition8u
326
{
327
    uchar*  currline;      /* pointer to the start of the current pixel line   */
328
    uchar*  topline;       /* pointer to the start of the top pixel line       */
329
    uchar*  bottomline;    /* pointer to the start of the first line           */
330
                                    /* which is below the image                         */
331
    int     x;                      /* current x coordinate ( in pixels )               */
332
    int     width;                  /* width of the image  ( in pixels )                */
333
    int     height;                 /* height of the image  ( in pixels )               */
334
    int     step;                   /* distance between lines ( in elements of single   */
335
                                    /* plane )                                          */
336
    int     step_arr[3];            /* array: ( 0, -step, step ). It is used for        */
337
                                    /* vertical moving                                  */
338
} CvPixelPosition8u;
339
340
/* this structure differs from the above only in data type */
341
typedef struct _CvPixelPosition8s
342
{
343
    schar*  currline;
344
    schar*  topline;
345
    schar*  bottomline;
346
    int     x;
347
    int     width;
348
    int     height;
349
    int     step;
350
    int     step_arr[3];
351
} CvPixelPosition8s;
352
353
/* this structure differs from the CvPixelPosition8u only in data type */
354
typedef struct _CvPixelPosition32f
355
{
356
    float*  currline;
357
    float*  topline;
358
    float*  bottomline;
359
    int     x;
360
    int     width;
361
    int     height;
362
    int     step;
363
    int     step_arr[3];
364
} CvPixelPosition32f;
365
366
367
/* Initialize one of the CvPixelPosition structures.   */
368
/*  pos    - initialized structure                     */
369
/*  origin - pointer to the left-top corner of the ROI */
370
/*  step   - width of the whole image in bytes         */
371
/*  roi    - width & height of the ROI                 */
372
/*  x, y   - initial position                          */
373
#define CV_INIT_PIXEL_POS(pos, origin, _step, roi, _x, _y, orientation)    \
374
    (                                                                        \
375
    (pos).step = (_step)/sizeof((pos).currline[0]) * (orientation ? -1 : 1), \
376
    (pos).width = (roi).width,                                               \
377
    (pos).height = (roi).height,                                             \
378
    (pos).bottomline = (origin) + (pos).step*(pos).height,                   \
379
    (pos).topline = (origin) - (pos).step,                                   \
380
    (pos).step_arr[0] = 0,                                                   \
381
    (pos).step_arr[1] = -(pos).step,                                         \
382
    (pos).step_arr[2] = (pos).step,                                          \
383
    (pos).x = (_x),                                                          \
384
    (pos).currline = (origin) + (pos).step*(_y) )
385
386
387
/* Move to specified point ( absolute shift ) */
388
/*  pos    - position structure               */
389
/*  x, y   - coordinates of the new position  */
390
/*  cs     - number of the image channels     */
391
#define CV_MOVE_TO( pos, _x, _y, cs )                                                   \
392
((pos).currline = (_y) >= 0 && (_y) < (pos).height ? (pos).topline + ((_y)+1)*(pos).step : 0, \
393
 (pos).x = (_x) >= 0 && (_x) < (pos).width ? (_x) : 0, (pos).currline + (_x) * (cs) )
394
395
/* Get current coordinates                    */
396
/*  pos    - position structure               */
397
/*  x, y   - coordinates of the new position  */
398
/*  cs     - number of the image channels     */
399
#define CV_GET_CURRENT( pos, cs )  ((pos).currline + (pos).x * (cs))
400
401
/* Move by one pixel relatively to current position */
402
/*  pos    - position structure                     */
403
/*  cs     - number of the image channels           */
404
405
/* left */
406
#define CV_MOVE_LEFT( pos, cs ) \
407
 ( --(pos).x >= 0 ? (pos).currline + (pos).x*(cs) : 0 )
408
409
/* right */
410
#define CV_MOVE_RIGHT( pos, cs ) \
411
 ( ++(pos).x < (pos).width ? (pos).currline + (pos).x*(cs) : 0 )
412
413
/* up */
414
#define CV_MOVE_UP( pos, cs ) \
415
 (((pos).currline -= (pos).step) != (pos).topline ? (pos).currline + (pos).x*(cs) : 0 )
416
417
/* down */
418
#define CV_MOVE_DOWN( pos, cs ) \
419
 (((pos).currline += (pos).step) != (pos).bottomline ? (pos).currline + (pos).x*(cs) : 0 )
420
421
/* left up */
422
#define CV_MOVE_LU( pos, cs ) ( CV_MOVE_LEFT(pos, cs), CV_MOVE_UP(pos, cs))
423
424
/* right up */
425
#define CV_MOVE_RU( pos, cs ) ( CV_MOVE_RIGHT(pos, cs), CV_MOVE_UP(pos, cs))
426
427
/* left down */
428
#define CV_MOVE_LD( pos, cs ) ( CV_MOVE_LEFT(pos, cs), CV_MOVE_DOWN(pos, cs))
429
430
/* right down */
431
#define CV_MOVE_RD( pos, cs ) ( CV_MOVE_RIGHT(pos, cs), CV_MOVE_DOWN(pos, cs))
432
433
434
435
/* Move by one pixel relatively to current position with wrapping when the position     */
436
/* achieves image boundary                                                              */
437
/*  pos    - position structure                                                         */
438
/*  cs     - number of the image channels                                               */
439
440
/* left */
441
#define CV_MOVE_LEFT_WRAP( pos, cs ) \
442
 ((pos).currline + ( --(pos).x >= 0 ? (pos).x : ((pos).x = (pos).width-1))*(cs))
443
444
/* right */
445
#define CV_MOVE_RIGHT_WRAP( pos, cs ) \
446
 ((pos).currline + ( ++(pos).x < (pos).width ? (pos).x : ((pos).x = 0))*(cs) )
447
448
/* up */
449
#define CV_MOVE_UP_WRAP( pos, cs ) \
450
    ((((pos).currline -= (pos).step) != (pos).topline ? \
451
    (pos).currline : ((pos).currline = (pos).bottomline - (pos).step)) + (pos).x*(cs) )
452
453
/* down */
454
#define CV_MOVE_DOWN_WRAP( pos, cs ) \
455
    ((((pos).currline += (pos).step) != (pos).bottomline ? \
456
    (pos).currline : ((pos).currline = (pos).topline + (pos).step)) + (pos).x*(cs) )
457
458
/* left up */
459
#define CV_MOVE_LU_WRAP( pos, cs ) ( CV_MOVE_LEFT_WRAP(pos, cs), CV_MOVE_UP_WRAP(pos, cs))
460
/* right up */
461
#define CV_MOVE_RU_WRAP( pos, cs ) ( CV_MOVE_RIGHT_WRAP(pos, cs), CV_MOVE_UP_WRAP(pos, cs))
462
/* left down */
463
#define CV_MOVE_LD_WRAP( pos, cs ) ( CV_MOVE_LEFT_WRAP(pos, cs), CV_MOVE_DOWN_WRAP(pos, cs))
464
/* right down */
465
#define CV_MOVE_RD_WRAP( pos, cs ) ( CV_MOVE_RIGHT_WRAP(pos, cs), CV_MOVE_DOWN_WRAP(pos, cs))
466
467
/* Numeric constants which used for moving in arbitrary direction  */
468
enum
469
{
470
    CV_SHIFT_NONE = 2,
471
    CV_SHIFT_LEFT = 1,
472
    CV_SHIFT_RIGHT = 3,
473
    CV_SHIFT_UP = 6,
474
    CV_SHIFT_DOWN = 10,
475
    CV_SHIFT_LU = 5,
476
    CV_SHIFT_RU = 7,
477
    CV_SHIFT_LD = 9,
478
    CV_SHIFT_RD = 11
479
};
480
481
/* Move by one pixel in specified direction                                     */
482
/*  pos    - position structure                                                 */
483
/*  shift  - direction ( it's value must be one of the CV_SHIFT_Ö constants ) */
484
/*  cs     - number of the image channels                                       */
485
#define CV_MOVE_PARAM( pos, shift, cs )                                             \
486
    ( (pos).currline += (pos).step_arr[(shift)>>2], (pos).x += ((shift)&3)-2,       \
487
    ((pos).currline != (pos).topline && (pos).currline != (pos).bottomline &&       \
488
    (pos).x >= 0 && (pos).x < (pos).width) ? (pos).currline + (pos).x*(cs) : 0 )
489
490
/* Move by one pixel in specified direction with wrapping when the               */
491
/* position achieves image boundary                                              */
492
/*  pos    - position structure                                                  */
493
/*  shift  - direction ( it's value must be one of the CV_SHIFT_Ö constants )  */
494
/*  cs     - number of the image channels                                        */
495
#define CV_MOVE_PARAM_WRAP( pos, shift, cs )                                        \
496
    ( (pos).currline += (pos).step_arr[(shift)>>2],                                 \
497
    (pos).currline = ((pos).currline == (pos).topline ?                             \
498
    (pos).bottomline - (pos).step :                                                 \
499
    (pos).currline == (pos).bottomline ?                                            \
500
    (pos).topline + (pos).step : (pos).currline),                                   \
501
                                                                                    \
502
    (pos).x += ((shift)&3)-2,                                                       \
503
    (pos).x = ((pos).x < 0 ? (pos).width-1 : (pos).x >= (pos).width ? 0 : (pos).x), \
504
                                                                                    \
505
    (pos).currline + (pos).x*(cs) )
506
507
508
typedef float*   CvVect32f;
509
typedef float*   CvMatr32f;
510
typedef double*  CvVect64d;
511
typedef double*  CvMatr64d;
512
513
CV_EXPORTS void cvUnDistortOnce( const CvArr* src, CvArr* dst,
514
                                const float* intrinsic_matrix,
515
                                const float* distortion_coeffs,
516
                                int interpolate );
517
518
/* the two functions below have quite hackerish implementations, use with care
519
   (or, which is better, switch to cvUndistortInitMap and cvRemap instead */
520
CV_EXPORTS void cvUnDistortInit( const CvArr* src,
521
                                CvArr* undistortion_map,
522
                                const float* A, const float* k,
523
                                int interpolate );
524
525
CV_EXPORTS void  cvUnDistort( const CvArr* src, CvArr* dst,
526
                             const CvArr* undistortion_map,
527
                             int interpolate );
528
                             
529
/* Find fundamental matrix */
530
CV_EXPORTS void  cvFindFundamentalMatrix( int* points1, int* points2,
531
    int numpoints, int method, float* matrix );
532
533
534
CV_EXPORTS int cvFindChessBoardCornerGuesses( const void* arr, void* thresharr,
535
                               CvMemStorage* storage,
536
                               CvSize pattern_size, CvPoint2D32f * corners,
537
                               int *corner_count );
538
539
/* Calibrates camera using multiple views of calibration pattern */
540
CV_EXPORTS void cvCalibrateCamera( int image_count, int* _point_counts,
541
    CvSize image_size, CvPoint2D32f* _image_points, CvPoint3D32f* _object_points,
542
    float* _distortion_coeffs, float* _camera_matrix, float* _translation_vectors,
543
    float* _rotation_matrices, int flags );
544
545
546
CV_EXPORTS void cvCalibrateCamera_64d( int image_count, int* _point_counts,
547
    CvSize image_size, CvPoint2D64f* _image_points, CvPoint3D64f* _object_points,
548
    double* _distortion_coeffs, double* _camera_matrix, double* _translation_vectors,
549
    double* _rotation_matrices, int flags );
550
551
552
/* Find 3d position of object given intrinsic camera parameters,
553
   3d model of the object and projection of the object into view plane */
554
CV_EXPORTS void cvFindExtrinsicCameraParams( int point_count,
555
    CvSize image_size, CvPoint2D32f* _image_points,
556
    CvPoint3D32f* _object_points, float* focal_length,
557
    CvPoint2D32f principal_point, float* _distortion_coeffs,
558
    float* _rotation_vector, float* _translation_vector );
559
560
/* Variant of the previous function that takes double-precision parameters */
561
CV_EXPORTS void cvFindExtrinsicCameraParams_64d( int point_count,
562
    CvSize image_size, CvPoint2D64f* _image_points,
563
    CvPoint3D64f* _object_points, double* focal_length,
564
    CvPoint2D64f principal_point, double* _distortion_coeffs,
565
    double* _rotation_vector, double* _translation_vector );
566
567
/* Rodrigues transform */
568
enum
569
{
570
    CV_RODRIGUES_M2V = 0,
571
    CV_RODRIGUES_V2M = 1
572
};
573
574
/* Converts rotation_matrix matrix to rotation_matrix vector or vice versa */
575
CV_EXPORTS void  cvRodrigues( CvMat* rotation_matrix, CvMat* rotation_vector,
576
                              CvMat* jacobian, int conv_type );
577
578
/* Does reprojection of 3d object points to the view plane */
579
CV_EXPORTS void  cvProjectPoints( int point_count, CvPoint3D64f* _object_points,
580
    double* _rotation_vector, double*  _translation_vector,
581
    double* focal_length, CvPoint2D64f principal_point,
582
    double* _distortion, CvPoint2D64f* _image_points,
583
    double* _deriv_points_rotation_matrix,
584
    double* _deriv_points_translation_vect,
585
    double* _deriv_points_focal,
586
    double* _deriv_points_principal_point,
587
    double* _deriv_points_distortion_coeffs );
588
589
590
/* Simpler version of the previous function */
591
CV_EXPORTS void  cvProjectPointsSimple( int point_count, CvPoint3D64f* _object_points,
592
    double* _rotation_matrix, double*  _translation_vector,
593
    double* _camera_matrix, double* _distortion, CvPoint2D64f* _image_points );
594
595
596
#define cvMake2DPoints cvConvertPointsHomogeneous
597
#define cvMake3DPoints cvConvertPointsHomogeneous
598
599
#define cvWarpPerspectiveQMatrix cvGetPerspectiveTransform
600
601
#define cvConvertPointsHomogenious cvConvertPointsHomogeneous
602
603
604
#ifdef __cplusplus
605
}
606
#endif
607
608
#endif