56 #define CV_UNREFERENCED(arg)
58 #define CV_UNREFERENCED(arg) arg
62 #define CvDisMaskType int
63 #define CvMatArray CvMat
65 #define CvThreshType int
66 #define CvAdaptiveThreshMethod int
67 #define CvCompareMethod int
68 #define CvFontFace int
69 #define CvPolyApproxMethod int
70 #define CvContoursMatchMethod int
71 #define CvContourTreesMatchMethod int
72 #define CvCoeffType int
73 #define CvRodriguesType int
74 #define CvElementShape int
76 #define CvTemplMatchMethod int
78 #define CvPoint2D64d CvPoint2D64f
79 #define CvPoint3D64d CvPoint3D64f
81 #define CV_MAT32F CV_32FC1
82 #define CV_MAT3x1_32F CV_32FC1
83 #define CV_MAT4x1_32F CV_32FC1
84 #define CV_MAT3x3_32F CV_32FC1
85 #define CV_MAT4x4_32F CV_32FC1
87 #define CV_MAT64D CV_64FC1
88 #define CV_MAT3x1_64D CV_64FC1
89 #define CV_MAT4x1_64D CV_64FC1
90 #define CV_MAT3x3_64D CV_64FC1
91 #define CV_MAT4x4_64D CV_64FC1
93 #define IPL_GAUSSIAN_5x5 7
94 #define CvBox2D32f CvBox2D
97 #define cvCreateImageData cvCreateData
98 #define cvReleaseImageData cvReleaseData
99 #define cvSetImageData cvSetData
100 #define cvGetImageRawData cvGetRawData
102 #define cvmAlloc cvCreateData
103 #define cvmFree cvReleaseData
104 #define cvmAllocArray cvCreateData
105 #define cvmFreeArray cvReleaseData
107 #define cvIntegralImage cvIntegral
108 #define cvMatchContours cvMatchShapes
113 return cvMat( rows*count, cols, type,
data );
116 #define cvUpdateMHIByTime cvUpdateMotionHistory
118 #define cvAccMask cvAcc
119 #define cvSquareAccMask cvSquareAcc
120 #define cvMultiplyAccMask cvMultiplyAcc
121 #define cvRunningAvgMask(imgY, imgU, mask, alpha) cvRunningAvg(imgY, imgU, alpha, mask)
123 #define cvSetHistThresh cvSetHistBinRanges
124 #define cvCalcHistMask(img, mask, hist, doNotClear) cvCalcHist(img, hist, doNotClear, mask)
136 return scalar.
val[0];
146 *mean = _mean.
val[0];
170 #define cvCvtPixToPlane cvSplit
171 #define cvCvtPlaneToPix cvMerge
192 if( (
unsigned)(
index + 1) > 4 )
214 double param2,
int seed,
246 #define cvRandNext( _state ) cvRandInt( &(_state)->state )
264 mm.
data.
fl = (
float*)magnitude;
265 ma.
data.
fl = (
float*)angle;
279 ma.
data.
fl = (
float*)angle;
291 cvPow( &mx, &my, 0.5 );
301 cvPow( &mx, &my, -0.5 );
311 cvPow( &mx, &my, -1 );
342 #define cvPseudoInv cvPseudoInverse
344 #define cvContourMoments( contour, moments ) \
345 cvMoments( contour, moments, 0 )
347 #define cvGetPtrAt cvPtr2D
348 #define cvGetAt cvGet2D
349 #define cvSetAt(arr,val,y,x) cvSet2D((arr),(y),(x),(val))
351 #define cvMeanMask cvMean
352 #define cvMean_StdDevMask(img,mask,mean,sdv) cvMean_StdDev(img,mean,sdv,mask)
354 #define cvNormMask(imgA,imgB,mask,normType) cvNorm(imgA,imgB,normType,mask)
356 #define cvMinMaxLocMask(img, mask, min_val, max_val, min_loc, max_loc) \
357 cvMinMaxLoc(img, min_val, max_val, min_loc, max_loc, mask)
359 #define cvRemoveMemoryManager cvSetMemoryManager
361 #define cvmSetZero( mat ) cvSetZero( mat )
362 #define cvmSetIdentity( mat ) cvSetIdentity( mat )
363 #define cvmAdd( src1, src2, dst ) cvAdd( src1, src2, dst, 0 )
364 #define cvmSub( src1, src2, dst ) cvSub( src1, src2, dst, 0 )
365 #define cvmCopy( src, dst ) cvCopy( src, dst, 0 )
366 #define cvmMul( src1, src2, dst ) cvMatMulAdd( src1, src2, 0, dst )
367 #define cvmTranspose( src, dst ) cvT( src, dst )
368 #define cvmInvert( src, dst ) cvInv( src, dst )
369 #define cvmMahalanobis(vec1, vec2, mat) cvMahalanobis( vec1, vec2, mat )
370 #define cvmDotProduct( vec1, vec2 ) cvDotProduct( vec1, vec2 )
371 #define cvmCrossProduct(vec1, vec2,dst) cvCrossProduct( vec1, vec2, dst )
372 #define cvmTrace( mat ) (cvTrace( mat )).val[0]
373 #define cvmMulTransposed( src, dst, order ) cvMulTransposed( src, dst, order )
374 #define cvmEigenVV( mat, evec, eval, eps) cvEigenVV( mat, evec, eval, eps )
375 #define cvmDet( mat ) cvDet( mat )
376 #define cvmScale( src, dst, scale ) cvScale( src, dst, scale )
378 #define cvCopyImage( src, dst ) cvCopy( src, dst, 0 )
379 #define cvReleaseMatHeader cvReleaseMat
390 *hullsize = hull1.
cols;
394 #define cvContourConvexHull( contour, orientation, storage ) \
395 cvConvexHull2( contour, storage, orientation )
398 #define cvConvexHullApprox( points, num_points, bound_rect, bandwidth, \
399 orientation, hull, hullsize ) \
400 cvConvexHull( points, num_points, bound_rect, orientation, hull, hullsize )
403 #define cvContourConvexHullApprox( contour, bandwidth, orientation, storage ) \
404 cvConvexHull2( contour, storage, orientation )
420 vect1->
x = pt[1].
x - pt[0].
x;
421 vect1->
y = pt[1].
y - pt[0].
y;
422 vect2->
x = pt[3].
x - pt[0].
x;
423 vect2->
y = pt[3].
y - pt[0].
y;
436 float _param = param != NULL ? *(
float*)param : 0.f;
438 cvFitLine( &mat, dist, _param, reps, aeps, line );
446 float _param = param != NULL ? *(
float*)param : 0.f;
448 cvFitLine( &mat, dist, _param, reps, aeps, line );
467 float m[6] = {0,0,0,0,0,0};
470 assert( (
unsigned)xIndx < 3 && (
unsigned)yIndx < 3 );
471 m[xIndx] = m[yIndx+3] = 1.f;
479 #define cvQueryHistValue_1D( hist, idx0 ) \
480 ((float)cvGetReal1D( (hist)->bins, (idx0)))
481 #define cvQueryHistValue_2D( hist, idx0, idx1 ) \
482 ((float)cvGetReal2D( (hist)->bins, (idx0), (idx1)))
483 #define cvQueryHistValue_3D( hist, idx0, idx1, idx2 ) \
484 ((float)cvGetReal3D( (hist)->bins, (idx0), (idx1), (idx2)))
485 #define cvQueryHistValue_nD( hist, idx ) \
486 ((float)cvGetRealND( (hist)->bins, (idx)))
490 #define cvGetHistValue_1D( hist, idx0 ) \
491 ((float*)cvPtr1D( (hist)->bins, (idx0), 0))
492 #define cvGetHistValue_2D( hist, idx0, idx1 ) \
493 ((float*)cvPtr2D( (hist)->bins, (idx0), (idx1), 0))
494 #define cvGetHistValue_3D( hist, idx0, idx1, idx2 ) \
495 ((float*)cvPtr3D( (hist)->bins, (idx0), (idx1), (idx2), 0))
496 #define cvGetHistValue_nD( hist, idx ) \
497 ((float*)cvPtrND( (hist)->bins, (idx), 0))
500 #define CV_IS_SET_ELEM_EXISTS CV_IS_SET_ELEM
505 float*
lines,
int linesNumber )
509 rho, theta, threshold, 0, 0 );
511 return linesMat.
cols;
517 int lineLength,
int lineGap,
518 int*
lines,
int linesNumber )
522 rho, theta, threshold, lineLength, lineGap );
524 return linesMat.
cols;
530 float*
lines,
int linesNumber )
534 rho, theta, threshold, srn, stn );
536 return linesMat.
cols;
552 for( i = 0; i < numpoints; i++ )
554 cvmSet(pointsMat1,0,i,points1[curr]);
555 cvmSet(pointsMat1,1,i,points1[curr+1]);
556 cvmSet(pointsMat1,2,i,1.0);
558 cvmSet(pointsMat2,0,i,points2[curr]);
559 cvmSet(pointsMat2,1,i,points2[curr+1]);
560 cvmSet(pointsMat2,2,i,1.0);
586 float* _distortion_coeffs,
float* _camera_matrix,
float* _translation_vectors,
587 float* _rotation_matrices,
int flags )
597 for( i = 0; i < image_count; i++ )
598 total += _point_counts[i];
604 &camera_matrix, &dist_coeffs, &rotation_matrices, &translation_vectors,
611 double* _distortion_coeffs,
double* _camera_matrix,
double* _translation_vectors,
612 double* _rotation_matrices,
int flags )
622 for( i = 0; i < image_count; i++ )
623 total += _point_counts[i];
629 &camera_matrix, &dist_coeffs, &rotation_matrices, &translation_vectors,
640 CvPoint2D32f principal_point,
float* _distortion_coeffs,
641 float* _rotation_vector,
float* _translation_vector )
651 a[0] = focal_length[0]; a[4] = focal_length[1];
652 a[2] = principal_point.
x; a[5] = principal_point.
y;
653 a[1] = a[3] = a[6] = a[7] = 0.f;
657 &dist_coeffs, &rotation_vector, &translation_vector );
665 CvPoint2D64f principal_point,
double* _distortion_coeffs,
666 double* _rotation_vector,
double* _translation_vector )
676 a[0] = focal_length[0]; a[4] = focal_length[1];
677 a[2] = principal_point.
x; a[5] = principal_point.
y;
678 a[1] = a[3] = a[6] = a[7] = 0.;
682 &dist_coeffs, &rotation_vector, &translation_vector );
687 #define CV_RODRIGUES_M2V 0
688 #define CV_RODRIGUES_V2M 1
692 CvMat* jacobian,
int conv_type )
695 cvRodrigues2( rotation_vector, rotation_matrix, jacobian );
697 cvRodrigues2( rotation_matrix, rotation_vector, jacobian );
703 double* _rotation_vector,
double* _translation_vector,
706 double* _deriv_points_rotation_matrix,
707 double* _deriv_points_translation_vect,
708 double* _deriv_points_focal,
709 double* _deriv_points_principal_point,
710 double* _deriv_points_distortion_coeffs )
725 a[0] = focal_length[0]; a[4] = focal_length[1];
726 a[2] = principal_point.
x; a[5] = principal_point.
y;
727 a[1] = a[3] = a[6] = a[7] = 0.;
731 &camera_matrix, &dist_coeffs, &image_points,
732 &dpdr, &dpdt, &dpdf, &dpdc, &dpdk, 0 );
738 double* _rotation_matrix,
double* _translation_vector,
739 double* _camera_matrix,
double* _distortion,
CvPoint2D64f* _image_points )
749 &camera_matrix, &dist_coeffs, &image_points,
755 const float* intrinsic_matrix,
768 CvArr* undistortion_map,
769 const float* A,
const float*
k,
777 data.fl[0] = A[0];
data.fl[1] = A[4];
778 data.fl[2] = A[2];
data.fl[3] = A[5];
779 data.fl[4] = k[0];
data.fl[5] = k[1];
780 data.fl[6] = k[2];
data.fl[7] = k[3];
784 const CvArr* undistortion_map,
788 float a[] = {0,0,0,0,0,0,0,0,1};
792 a[0] =
data.fl[0]; a[4] =
data.fl[1];
793 a[2] =
data.fl[2]; a[5] =
data.fl[3];
813 int num_samples,
int vec_size,
819 for( i = 0; i < num_samples; i++ )
820 memcpy( samples_mat->
data.
fl + i*vec_size, samples[i], vec_size*
sizeof(
float));
821 cvKMeans2( samples_mat, num_clusters, &cluster_idx_mat, termcrit );
836 *scanner = *temp_scanner;
849 *temp_scanner = *scanner;
851 memset( scanner, 0,
sizeof(*scanner) );
856 #define cvKalmanUpdateByTime cvKalmanPredict
857 #define cvKalmanUpdateByMeasurement cvKalmanCorrect
877 cvEllipse( img, center, axes, angle, start_angle, end_angle,
884 cvPolyLine( img, pts, npts, contours, is_closed,
890 #define cvMake2DPoints cvConvertPointsHomogeneous
891 #define cvMake3DPoints cvConvertPointsHomogeneous
893 #define cvWarpPerspectiveQMatrix cvGetPerspectiveTransform
895 #define cvConvertPointsHomogenious cvConvertPointsHomogeneous
949 #define CV_INIT_PIXEL_POS(pos, origin, _step, roi, _x, _y, orientation) \
951 (pos).step = (_step)/sizeof((pos).currline[0]) * (orientation ? -1 : 1), \
952 (pos).width = (roi).width, \
953 (pos).height = (roi).height, \
954 (pos).bottomline = (origin) + (pos).step*(pos).height, \
955 (pos).topline = (origin) - (pos).step, \
956 (pos).step_arr[0] = 0, \
957 (pos).step_arr[1] = -(pos).step, \
958 (pos).step_arr[2] = (pos).step, \
960 (pos).currline = (origin) + (pos).step*(_y) )
967 #define CV_MOVE_TO( pos, _x, _y, cs ) \
968 ((pos).currline = (_y) >= 0 && (_y) < (pos).height ? (pos).topline + ((_y)+1)*(pos).step : 0, \
969 (pos).x = (_x) >= 0 && (_x) < (pos).width ? (_x) : 0, (pos).currline + (_x) * (cs) )
975 #define CV_GET_CURRENT( pos, cs ) ((pos).currline + (pos).x * (cs))
982 #define CV_MOVE_LEFT( pos, cs ) \
983 ( --(pos).x >= 0 ? (pos).currline + (pos).x*(cs) : 0 )
986 #define CV_MOVE_RIGHT( pos, cs ) \
987 ( ++(pos).x < (pos).width ? (pos).currline + (pos).x*(cs) : 0 )
990 #define CV_MOVE_UP( pos, cs ) \
991 (((pos).currline -= (pos).step) != (pos).topline ? (pos).currline + (pos).x*(cs) : 0 )
994 #define CV_MOVE_DOWN( pos, cs ) \
995 (((pos).currline += (pos).step) != (pos).bottomline ? (pos).currline + (pos).x*(cs) : 0 )
998 #define CV_MOVE_LU( pos, cs ) ( CV_MOVE_LEFT(pos, cs), CV_MOVE_UP(pos, cs))
1001 #define CV_MOVE_RU( pos, cs ) ( CV_MOVE_RIGHT(pos, cs), CV_MOVE_UP(pos, cs))
1004 #define CV_MOVE_LD( pos, cs ) ( CV_MOVE_LEFT(pos, cs), CV_MOVE_DOWN(pos, cs))
1007 #define CV_MOVE_RD( pos, cs ) ( CV_MOVE_RIGHT(pos, cs), CV_MOVE_DOWN(pos, cs))
1017 #define CV_MOVE_LEFT_WRAP( pos, cs ) \
1018 ((pos).currline + ( --(pos).x >= 0 ? (pos).x : ((pos).x = (pos).width-1))*(cs))
1021 #define CV_MOVE_RIGHT_WRAP( pos, cs ) \
1022 ((pos).currline + ( ++(pos).x < (pos).width ? (pos).x : ((pos).x = 0))*(cs) )
1025 #define CV_MOVE_UP_WRAP( pos, cs ) \
1026 ((((pos).currline -= (pos).step) != (pos).topline ? \
1027 (pos).currline : ((pos).currline = (pos).bottomline - (pos).step)) + (pos).x*(cs) )
1030 #define CV_MOVE_DOWN_WRAP( pos, cs ) \
1031 ((((pos).currline += (pos).step) != (pos).bottomline ? \
1032 (pos).currline : ((pos).currline = (pos).topline + (pos).step)) + (pos).x*(cs) )
1035 #define CV_MOVE_LU_WRAP( pos, cs ) ( CV_MOVE_LEFT_WRAP(pos, cs), CV_MOVE_UP_WRAP(pos, cs))
1037 #define CV_MOVE_RU_WRAP( pos, cs ) ( CV_MOVE_RIGHT_WRAP(pos, cs), CV_MOVE_UP_WRAP(pos, cs))
1039 #define CV_MOVE_LD_WRAP( pos, cs ) ( CV_MOVE_LEFT_WRAP(pos, cs), CV_MOVE_DOWN_WRAP(pos, cs))
1041 #define CV_MOVE_RD_WRAP( pos, cs ) ( CV_MOVE_RIGHT_WRAP(pos, cs), CV_MOVE_DOWN_WRAP(pos, cs))
1044 #define CV_SHIFT_NONE 2
1045 #define CV_SHIFT_LEFT 1
1046 #define CV_SHIFT_RIGHT 3
1047 #define CV_SHIFT_UP 6
1048 #define CV_SHIFT_DOWN 10
1049 #define CV_SHIFT_LU 5
1050 #define CV_SHIFT_RU 7
1051 #define CV_SHIFT_LD 9
1052 #define CV_SHIFT_RD 11
1058 #define CV_MOVE_PARAM( pos, shift, cs ) \
1059 ( (pos).currline += (pos).step_arr[(shift)>>2], (pos).x += ((shift)&3)-2, \
1060 ((pos).currline != (pos).topline && (pos).currline != (pos).bottomline && \
1061 (pos).x >= 0 && (pos).x < (pos).width) ? (pos).currline + (pos).x*(cs) : 0 )
1068 #define CV_MOVE_PARAM_WRAP( pos, shift, cs ) \
1069 ( (pos).currline += (pos).step_arr[(shift)>>2], \
1070 (pos).currline = ((pos).currline == (pos).topline ? \
1071 (pos).bottomline - (pos).step : \
1072 (pos).currline == (pos).bottomline ? \
1073 (pos).topline + (pos).step : (pos).currline), \
1075 (pos).x += ((shift)&3)-2, \
1076 (pos).x = ((pos).x < 0 ? (pos).width-1 : (pos).x >= (pos).width ? 0 : (pos).x), \
1078 (pos).currline + (pos).x*(cs) )