1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
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.
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2008-2010, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other materials provided with the distribution.
27 // * The name of Intel Corporation may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
43 #include "precomp.hpp"
44 #include "opencv2/calib3d/calib3d_c.h"
46 CvMat cvMatArray( int rows, int cols, int type,
47 int count, void* data)
49 return cvMat( rows*count, cols, type, data );
53 double cvMean( const CvArr* image, const CvArr* mask )
55 CvScalar mean = cvAvg( image, mask );
60 double cvSumPixels( const CvArr* image )
62 CvScalar scalar = cvSum( image );
66 void cvMean_StdDev( const CvArr* image, double* mean, double* sdv, const CvArr* mask)
69 cvAvgSdv( image, &_mean, &_sdv, mask );
79 void cvmPerspectiveProject( const CvMat* mat, const CvArr* src, CvArr* dst )
83 cvReshape( src, &tsrc, 3, 0 );
84 cvReshape( dst, &tdst, 3, 0 );
86 cvPerspectiveTransform( &tsrc, &tdst, mat );
90 void cvFillImage( CvArr* mat, double color )
92 cvSet( mat, cvColorToScalar(color, cvGetElemType(mat)), 0 );
96 /* Changes RNG range while preserving RNG state */
97 void cvRandSetRange( CvRandState* state, double param1, double param2, int index)
101 cvError( CV_StsNullPtr, "cvRandSetRange", "Null pointer to RNG state", "cvcompat.h", 0 );
105 if( (unsigned)(index + 1) > 4 )
107 cvError( CV_StsOutOfRange, "cvRandSetRange", "index is not in -1..3", "cvcompat.h", 0 );
113 state->param[0].val[0] = state->param[0].val[1] =
114 state->param[0].val[2] = state->param[0].val[3] = param1;
115 state->param[1].val[0] = state->param[1].val[1] =
116 state->param[1].val[2] = state->param[1].val[3] = param2;
120 state->param[0].val[index] = param1;
121 state->param[1].val[index] = param2;
126 void cvRandInit( CvRandState* state, double param1, double param2,
127 int seed, int disttype)
131 cvError( CV_StsNullPtr, "cvRandInit", "Null pointer to RNG state", "cvcompat.h", 0 );
135 if( disttype != CV_RAND_UNI && disttype != CV_RAND_NORMAL )
137 cvError( CV_StsBadFlag, "cvRandInit", "Unknown distribution type", "cvcompat.h", 0 );
141 state->state = (uint64)(seed ? seed : -1);
142 state->disttype = disttype;
143 cvRandSetRange( state, param1, param2, -1 );
147 /* Fills array with random numbers */
148 void cvRand( CvRandState* state, CvArr* arr )
152 cvError( CV_StsNullPtr, "cvRand", "Null pointer to RNG state", "cvcompat.h", 0 );
155 cvRandArr( &state->state, arr, state->disttype, state->param[0], state->param[1] );
158 void cvbRand( CvRandState* state, float* dst, int len )
160 CvMat mat = cvMat( 1, len, CV_32F, (void*)dst );
161 cvRand( state, &mat );
165 void cvbCartToPolar( const float* y, const float* x, float* magnitude, float* angle, int len )
167 CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
172 my.data.fl = (float*)y;
173 mm.data.fl = (float*)magnitude;
174 ma.data.fl = (float*)angle;
176 cvCartToPolar( &mx, &my, &mm, angle ? &ma : NULL, 1 );
180 void cvbFastArctan( const float* y, const float* x, float* angle, int len )
182 CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
186 my.data.fl = (float*)y;
187 ma.data.fl = (float*)angle;
189 cvCartToPolar( &mx, &my, NULL, &ma, 1 );
193 void cvbSqrt( const float* x, float* y, int len )
195 CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
197 my.data.fl = (float*)y;
199 cvPow( &mx, &my, 0.5 );
203 void cvbInvSqrt( const float* x, float* y, int len )
205 CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
207 my.data.fl = (float*)y;
209 cvPow( &mx, &my, -0.5 );
213 void cvbReciprocal( const float* x, float* y, int len )
215 CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
217 my.data.fl = (float*)y;
219 cvPow( &mx, &my, -1 );
223 void cvbFastExp( const float* x, double* y, int len )
226 for( i = 0; i < len; i++ )
227 y[i] = exp((double)x[i]);
231 void cvbFastLog( const double* x, float* y, int len )
234 for( i = 0; i < len; i++ )
235 y[i] = (float)log(x[i]);
239 CvRect cvContourBoundingRect( void* point_set, int update)
241 return cvBoundingRect( point_set, update );
245 double cvPseudoInverse( const CvArr* src, CvArr* dst )
247 return cvInvert( src, dst, CV_SVD );
251 /* Calculates exact convex hull of 2d point set */
252 void cvConvexHull( CvPoint* points, int num_points, CvRect*,
253 int orientation, int* hull, int* hullsize )
255 CvMat points1 = cvMat( 1, num_points, CV_32SC2, points );
256 CvMat hull1 = cvMat( 1, num_points, CV_32SC1, hull );
258 cvConvexHull2( &points1, &hull1, orientation, 0 );
259 *hullsize = hull1.cols;
262 void cvMinAreaRect( CvPoint* points, int n, int, int, int, int,
263 CvPoint2D32f* anchor, CvPoint2D32f* vect1, CvPoint2D32f* vect2 )
265 CvMat mat = cvMat( 1, n, CV_32SC2, points );
266 CvBox2D box = cvMinAreaRect2( &mat, 0 );
269 cvBoxPoints( box, pt );
271 vect1->x = pt[1].x - pt[0].x;
272 vect1->y = pt[1].y - pt[0].y;
273 vect2->x = pt[3].x - pt[0].x;
274 vect2->y = pt[3].y - pt[0].y;
277 void cvFitLine3D( CvPoint3D32f* points, int count, int dist,
278 void *param, float reps, float aeps, float* line )
280 CvMat mat = cvMat( 1, count, CV_32FC3, points );
281 float _param = param != NULL ? *(float*)param : 0.f;
282 assert( dist != CV_DIST_USER );
283 cvFitLine( &mat, dist, _param, reps, aeps, line );
286 /* Fits a line into set of 2d points in a robust way (M-estimator technique) */
287 void cvFitLine2D( CvPoint2D32f* points, int count, int dist,
288 void *param, float reps, float aeps, float* line )
290 CvMat mat = cvMat( 1, count, CV_32FC2, points );
291 float _param = param != NULL ? *(float*)param : 0.f;
292 assert( dist != CV_DIST_USER );
293 cvFitLine( &mat, dist, _param, reps, aeps, line );
297 void cvFitEllipse( const CvPoint2D32f* points, int count, CvBox2D* box )
299 CvMat mat = cvMat( 1, count, CV_32FC2, (void*)points );
300 *box = cvFitEllipse2( &mat );
303 /* Projects 2d points to one of standard coordinate planes
304 (i.e. removes one of coordinates) */
305 void cvProject3D( CvPoint3D32f* points3D, int count,
306 CvPoint2D32f* points2D, int xIndx, int yIndx)
308 CvMat src = cvMat( 1, count, CV_32FC3, points3D );
309 CvMat dst = cvMat( 1, count, CV_32FC2, points2D );
310 float m[6] = {0,0,0,0,0,0};
311 CvMat M = cvMat( 2, 3, CV_32F, m );
313 assert( (unsigned)xIndx < 3 && (unsigned)yIndx < 3 );
314 m[xIndx] = m[yIndx+3] = 1.f;
316 cvTransform( &src, &dst, &M, NULL );
320 int cvHoughLines( CvArr* image, double rho,
321 double theta, int threshold,
322 float* lines, int linesNumber )
324 CvMat linesMat = cvMat( 1, linesNumber, CV_32FC2, lines );
325 cvHoughLines2( image, &linesMat, CV_HOUGH_STANDARD,
326 rho, theta, threshold, 0, 0 );
328 return linesMat.cols;
332 int cvHoughLinesP( CvArr* image, double rho,
333 double theta, int threshold,
334 int lineLength, int lineGap,
335 int* lines, int linesNumber )
337 CvMat linesMat = cvMat( 1, linesNumber, CV_32SC4, lines );
338 cvHoughLines2( image, &linesMat, CV_HOUGH_PROBABILISTIC,
339 rho, theta, threshold, lineLength, lineGap );
341 return linesMat.cols;
345 int cvHoughLinesSDiv( CvArr* image, double rho, int srn,
346 double theta, int stn, int threshold,
347 float* lines, int linesNumber )
349 CvMat linesMat = cvMat( 1, linesNumber, CV_32FC2, lines );
350 cvHoughLines2( image, &linesMat, CV_HOUGH_MULTI_SCALE,
351 rho, theta, threshold, srn, stn );
353 return linesMat.cols;
357 float cvCalcEMD( const float* signature1, int size1, const float* signature2, int size2,
358 int dims, int dist_type, CvDistanceFunction dist_func,
359 float* lower_bound, void* user_param)
361 CvMat sign1 = cvMat( size1, dims + 1, CV_32FC1, (void*)signature1 );
362 CvMat sign2 = cvMat( size2, dims + 1, CV_32FC1, (void*)signature2 );
364 return cvCalcEMD2( &sign1, &sign2, dist_type, dist_func, 0, 0, lower_bound, user_param );
368 void cvKMeans( int num_clusters, float** samples,
369 int num_samples, int vec_size,
370 CvTermCriteria termcrit, int* cluster_idx )
372 CvMat* samples_mat = cvCreateMat( num_samples, vec_size, CV_32FC1 );
373 CvMat cluster_idx_mat = cvMat( num_samples, 1, CV_32SC1, cluster_idx );
375 for( i = 0; i < num_samples; i++ )
376 memcpy( samples_mat->data.fl + i*vec_size, samples[i], vec_size*sizeof(float));
377 cvKMeans2( samples_mat, num_clusters, &cluster_idx_mat, termcrit, 1, 0, 0, 0, 0 );
378 cvReleaseMat( &samples_mat );
382 void cvStartScanGraph( CvGraph* graph, CvGraphScanner* scanner,
383 CvGraphVtx* vtx, int mask)
385 CvGraphScanner* temp_scanner;
388 cvError( CV_StsNullPtr, "cvStartScanGraph", "Null scanner pointer", "cvcompat.h", 0 );
390 temp_scanner = cvCreateGraphScanner( graph, vtx, mask );
391 *scanner = *temp_scanner;
392 cvFree( &temp_scanner );
396 void cvEndScanGraph( CvGraphScanner* scanner )
399 cvError( CV_StsNullPtr, "cvEndScanGraph", "Null scanner pointer", "cvcompat.h", 0 );
403 CvGraphScanner* temp_scanner = (CvGraphScanner*)cvAlloc( sizeof(*temp_scanner) );
404 *temp_scanner = *scanner;
405 cvReleaseGraphScanner( &temp_scanner );
406 memset( scanner, 0, sizeof(*scanner) );
411 /* old drawing functions */
412 void cvLineAA( CvArr* img, CvPoint pt1, CvPoint pt2, double color, int scale)
414 cvLine( img, pt1, pt2, cvColorToScalar(color, cvGetElemType(img)), 1, CV_AA, scale );
417 void cvCircleAA( CvArr* img, CvPoint center, int radius, double color, int scale)
419 cvCircle( img, center, radius, cvColorToScalar(color, cvGetElemType(img)), 1, CV_AA, scale );
422 void cvEllipseAA( CvArr* img, CvPoint center, CvSize axes,
423 double angle, double start_angle,
424 double end_angle, double color,
427 cvEllipse( img, center, axes, angle, start_angle, end_angle,
428 cvColorToScalar(color, cvGetElemType(img)), 1, CV_AA, scale );
431 void cvPolyLineAA( CvArr* img, CvPoint** pts, int* npts, int contours,
432 int is_closed, double color, int scale )
434 cvPolyLine( img, pts, npts, contours, is_closed,
435 cvColorToScalar(color, cvGetElemType(img)),
440 void cvUnDistortOnce( const CvArr* src, CvArr* dst,
441 const float* intrinsic_matrix,
442 const float* distortion_coeffs,
445 CvMat _a = cvMat( 3, 3, CV_32F, (void*)intrinsic_matrix );
446 CvMat _k = cvMat( 4, 1, CV_32F, (void*)distortion_coeffs );
447 cvUndistort2( src, dst, &_a, &_k, 0 );
451 /* the two functions below have quite hackerish implementations, use with care
452 (or, which is better, switch to cvUndistortInitMap and cvRemap instead */
453 void cvUnDistortInit( const CvArr*,
454 CvArr* undistortion_map,
455 const float* A, const float* k,
458 union { uchar* ptr; float* fl; } data;
460 cvGetRawData( undistortion_map, &data.ptr, 0, &sz );
461 assert( sz.width >= 8 );
462 /* just save the intrinsic parameters to the map */
463 data.fl[0] = A[0]; data.fl[1] = A[4];
464 data.fl[2] = A[2]; data.fl[3] = A[5];
465 data.fl[4] = k[0]; data.fl[5] = k[1];
466 data.fl[6] = k[2]; data.fl[7] = k[3];
469 void cvUnDistort( const CvArr* src, CvArr* dst,
470 const CvArr* undistortion_map, int )
472 union { uchar* ptr; float* fl; } data;
473 float a[] = {0,0,0,0,0,0,0,0,1};
475 cvGetRawData( undistortion_map, &data.ptr, 0, &sz );
476 assert( sz.width >= 8 );
477 a[0] = data.fl[0]; a[4] = data.fl[1];
478 a[2] = data.fl[2]; a[5] = data.fl[3];
479 cvUnDistortOnce( src, dst, a, data.fl + 4, 1 );
483 /* Find fundamental matrix */
484 void cvFindFundamentalMatrix( int* points1, int* points2, int numpoints, int, float* matrix )
488 CvMat fundMatr = cvMat(3,3,CV_32F,matrix);
491 pointsMat1 = cvCreateMat(3,numpoints,CV_64F);
492 pointsMat2 = cvCreateMat(3,numpoints,CV_64F);
494 for( i = 0; i < numpoints; i++ )
496 cvmSet(pointsMat1,0,i,points1[curr]);//x
497 cvmSet(pointsMat1,1,i,points1[curr+1]);//y
498 cvmSet(pointsMat1,2,i,1.0);
500 cvmSet(pointsMat2,0,i,points2[curr]);//x
501 cvmSet(pointsMat2,1,i,points2[curr+1]);//y
502 cvmSet(pointsMat2,2,i,1.0);
506 cvFindFundamentalMat(pointsMat1,pointsMat2,&fundMatr,CV_FM_RANSAC,1,0.99,0);
508 cvReleaseMat(&pointsMat1);
509 cvReleaseMat(&pointsMat2);
513 int cvFindChessBoardCornerGuesses( const void* arr, void*,
514 CvMemStorage*, CvSize pattern_size,
515 CvPoint2D32f* corners, int* corner_count )
517 return cvFindChessboardCorners( arr, pattern_size, corners,
518 corner_count, CV_CALIB_CB_ADAPTIVE_THRESH );
522 /* Calibrates camera using multiple views of calibration pattern */
523 void cvCalibrateCamera( int image_count, int* _point_counts,
524 CvSize image_size, CvPoint2D32f* _image_points, CvPoint3D32f* _object_points,
525 float* _distortion_coeffs, float* _camera_matrix, float* _translation_vectors,
526 float* _rotation_matrices, int flags )
529 CvMat point_counts = cvMat( image_count, 1, CV_32SC1, _point_counts );
530 CvMat image_points, object_points;
531 CvMat dist_coeffs = cvMat( 4, 1, CV_32FC1, _distortion_coeffs );
532 CvMat camera_matrix = cvMat( 3, 3, CV_32FC1, _camera_matrix );
533 CvMat rotation_matrices = cvMat( image_count, 9, CV_32FC1, _rotation_matrices );
534 CvMat translation_vectors = cvMat( image_count, 3, CV_32FC1, _translation_vectors );
536 for( i = 0; i < image_count; i++ )
537 total += _point_counts[i];
539 image_points = cvMat( total, 1, CV_32FC2, _image_points );
540 object_points = cvMat( total, 1, CV_32FC3, _object_points );
542 cvCalibrateCamera2( &object_points, &image_points, &point_counts, image_size,
543 &camera_matrix, &dist_coeffs, &rotation_matrices, &translation_vectors,
548 void cvCalibrateCamera_64d( int image_count, int* _point_counts,
549 CvSize image_size, CvPoint2D64f* _image_points, CvPoint3D64f* _object_points,
550 double* _distortion_coeffs, double* _camera_matrix, double* _translation_vectors,
551 double* _rotation_matrices, int flags )
554 CvMat point_counts = cvMat( image_count, 1, CV_32SC1, _point_counts );
555 CvMat image_points, object_points;
556 CvMat dist_coeffs = cvMat( 4, 1, CV_64FC1, _distortion_coeffs );
557 CvMat camera_matrix = cvMat( 3, 3, CV_64FC1, _camera_matrix );
558 CvMat rotation_matrices = cvMat( image_count, 9, CV_64FC1, _rotation_matrices );
559 CvMat translation_vectors = cvMat( image_count, 3, CV_64FC1, _translation_vectors );
561 for( i = 0; i < image_count; i++ )
562 total += _point_counts[i];
564 image_points = cvMat( total, 1, CV_64FC2, _image_points );
565 object_points = cvMat( total, 1, CV_64FC3, _object_points );
567 cvCalibrateCamera2( &object_points, &image_points, &point_counts, image_size,
568 &camera_matrix, &dist_coeffs, &rotation_matrices, &translation_vectors,
574 /* Find 3d position of object given intrinsic camera parameters,
575 3d model of the object and projection of the object into view plane */
576 void cvFindExtrinsicCameraParams( int point_count,
577 CvSize, CvPoint2D32f* _image_points,
578 CvPoint3D32f* _object_points, float* focal_length,
579 CvPoint2D32f principal_point, float* _distortion_coeffs,
580 float* _rotation_vector, float* _translation_vector )
582 CvMat image_points = cvMat( point_count, 1, CV_32FC2, _image_points );
583 CvMat object_points = cvMat( point_count, 1, CV_32FC3, _object_points );
584 CvMat dist_coeffs = cvMat( 4, 1, CV_32FC1, _distortion_coeffs );
586 CvMat camera_matrix = cvMat( 3, 3, CV_32FC1, a );
587 CvMat rotation_vector = cvMat( 1, 1, CV_32FC3, _rotation_vector );
588 CvMat translation_vector = cvMat( 1, 1, CV_32FC3, _translation_vector );
590 a[0] = focal_length[0]; a[4] = focal_length[1];
591 a[2] = principal_point.x; a[5] = principal_point.y;
592 a[1] = a[3] = a[6] = a[7] = 0.f;
595 cvFindExtrinsicCameraParams2( &object_points, &image_points, &camera_matrix,
596 &dist_coeffs, &rotation_vector, &translation_vector, 0 );
600 /* Variant of the previous function that takes double-precision parameters */
601 void cvFindExtrinsicCameraParams_64d( int point_count,
602 CvSize, CvPoint2D64f* _image_points,
603 CvPoint3D64f* _object_points, double* focal_length,
604 CvPoint2D64f principal_point, double* _distortion_coeffs,
605 double* _rotation_vector, double* _translation_vector )
607 CvMat image_points = cvMat( point_count, 1, CV_64FC2, _image_points );
608 CvMat object_points = cvMat( point_count, 1, CV_64FC3, _object_points );
609 CvMat dist_coeffs = cvMat( 4, 1, CV_64FC1, _distortion_coeffs );
611 CvMat camera_matrix = cvMat( 3, 3, CV_64FC1, a );
612 CvMat rotation_vector = cvMat( 1, 1, CV_64FC3, _rotation_vector );
613 CvMat translation_vector = cvMat( 1, 1, CV_64FC3, _translation_vector );
615 a[0] = focal_length[0]; a[4] = focal_length[1];
616 a[2] = principal_point.x; a[5] = principal_point.y;
617 a[1] = a[3] = a[6] = a[7] = 0.;
620 cvFindExtrinsicCameraParams2( &object_points, &image_points, &camera_matrix,
621 &dist_coeffs, &rotation_vector, &translation_vector, 0 );
624 /* Converts rotation_matrix matrix to rotation_matrix vector or vice versa */
625 void cvRodrigues( CvMat* rotation_matrix, CvMat* rotation_vector,
626 CvMat* jacobian, int conv_type )
628 if( conv_type == CV_RODRIGUES_V2M )
629 cvRodrigues2( rotation_vector, rotation_matrix, jacobian );
631 cvRodrigues2( rotation_matrix, rotation_vector, jacobian );
635 /* Does reprojection of 3d object points to the view plane */
636 void cvProjectPoints( int point_count, CvPoint3D64f* _object_points,
637 double* _rotation_vector, double* _translation_vector,
638 double* focal_length, CvPoint2D64f principal_point,
639 double* _distortion, CvPoint2D64f* _image_points,
640 double* _deriv_points_rotation_matrix,
641 double* _deriv_points_translation_vect,
642 double* _deriv_points_focal,
643 double* _deriv_points_principal_point,
644 double* _deriv_points_distortion_coeffs )
646 CvMat object_points = cvMat( point_count, 1, CV_64FC3, _object_points );
647 CvMat image_points = cvMat( point_count, 1, CV_64FC2, _image_points );
648 CvMat rotation_vector = cvMat( 3, 1, CV_64FC1, _rotation_vector );
649 CvMat translation_vector = cvMat( 3, 1, CV_64FC1, _translation_vector );
651 CvMat camera_matrix = cvMat( 3, 3, CV_64FC1, a );
652 CvMat dist_coeffs = cvMat( 4, 1, CV_64FC1, _distortion );
653 CvMat dpdr = cvMat( 2*point_count, 3, CV_64FC1, _deriv_points_rotation_matrix );
654 CvMat dpdt = cvMat( 2*point_count, 3, CV_64FC1, _deriv_points_translation_vect );
655 CvMat dpdf = cvMat( 2*point_count, 2, CV_64FC1, _deriv_points_focal );
656 CvMat dpdc = cvMat( 2*point_count, 2, CV_64FC1, _deriv_points_principal_point );
657 CvMat dpdk = cvMat( 2*point_count, 4, CV_64FC1, _deriv_points_distortion_coeffs );
659 a[0] = focal_length[0]; a[4] = focal_length[1];
660 a[2] = principal_point.x; a[5] = principal_point.y;
661 a[1] = a[3] = a[6] = a[7] = 0.;
664 cvProjectPoints2( &object_points, &rotation_vector, &translation_vector,
665 &camera_matrix, &dist_coeffs, &image_points,
666 &dpdr, &dpdt, &dpdf, &dpdc, &dpdk, 0 );
670 /* Simpler version of the previous function */
671 void cvProjectPointsSimple( int point_count, CvPoint3D64f* _object_points,
672 double* _rotation_matrix, double* _translation_vector,
673 double* _camera_matrix, double* _distortion, CvPoint2D64f* _image_points )
675 CvMat object_points = cvMat( point_count, 1, CV_64FC3, _object_points );
676 CvMat image_points = cvMat( point_count, 1, CV_64FC2, _image_points );
677 CvMat rotation_matrix = cvMat( 3, 3, CV_64FC1, _rotation_matrix );
678 CvMat translation_vector = cvMat( 3, 1, CV_64FC1, _translation_vector );
679 CvMat camera_matrix = cvMat( 3, 3, CV_64FC1, _camera_matrix );
680 CvMat dist_coeffs = cvMat( 4, 1, CV_64FC1, _distortion );
682 cvProjectPoints2( &object_points, &rotation_matrix, &translation_vector,
683 &camera_matrix, &dist_coeffs, &image_points,