Ask Your Question

Thibault's profile - activity

2019-08-21 00:49:19 -0600 received badge  Popular Question (source)
2015-10-19 21:41:12 -0600 received badge  Nice Answer (source)
2014-05-19 01:55:27 -0600 received badge  Teacher (source)
2014-05-19 00:21:55 -0600 received badge  Self-Learner (source)
2014-05-19 00:10:59 -0600 answered a question cv::CalibrateCamera vs. cvCalibateCamera2 difference ?

I'm sorry after all it was my mistake. When I tried to make a sample code to report the bug I found out the problem came from my application. It was the size argument in cv::CalibrateCamera that sometimes contained wrong values leading to calibration error.

Thanks anyways it helped me figure it out !

2014-05-16 08:16:36 -0600 commented question cv::CalibrateCamera vs. cvCalibateCamera2 difference ?

Ok i'll do that. I'll triple check my data to make sure I didn't miss anything but I have tested on several datasets and I sometimes have exactly the same values and soemtimes they are different with better results for the C-API always

2014-05-16 07:34:20 -0600 commented question cv::CalibrateCamera vs. cvCalibateCamera2 difference ?

Ok i tried with 2.4.9, it doesn't change anything I still have the same results with better results calling the C-API ...

2014-05-16 06:47:08 -0600 commented question cv::CalibrateCamera vs. cvCalibateCamera2 difference ?

Ok i'll give that a try and come back.

2014-05-16 06:33:57 -0600 commented question cv::CalibrateCamera vs. cvCalibateCamera2 difference ?

I'm using 2.4.2 in both case.

2014-05-16 05:36:03 -0600 commented question cv::CalibrateCamera vs. cvCalibateCamera2 difference ?

Thanks for your comment, that's the reason I want to get rid of all the old C-API functions. The problem is I get wrong results with the C++-API on the exact same data whereas C-API provides still the good answer.

2014-05-16 03:21:05 -0600 asked a question cv::CalibrateCamera vs. cvCalibateCamera2 difference ?

Hi,

I am using two different codes for camera calibration (one with the old C interface and one with the C++ interface) I want to unify this using only C++ interface but when I run the functions cv::calibrateCamera and cvCalibrateCamera2 on the exact same data I get different results and the C results are much better.

Here is the core function that I tested :

vector<vector<Point3f>> modele_points;
vector<vector<Point2f>> image_points;

//I skip the code to fill the vectors

double rms_error = calibrateCamera(model_points, image_points,size, intrinsic, disto, rotations, translations,flags);//flags = 0

and :

CvMat* cam_image_points        = cvCreateMat(n_boards*cam_board_n,2, CV_32FC1);
CvMat* cam_object_points       = cvCreateMat(n_boards*cam_board_n,3, CV_32FC1);
CvMat* cam_point_counts        = cvCreateMat(n_boards, 1, CV_32SC1);

CvMat* cam_rotation_vectors    = cvCreateMat(n_boards, 3, CV_32FC1);
CvMat* cam_translation_vectors = cvCreateMat(n_boards, 3, CV_32FC1);
CvMat* camera_matrix           = cvCreateMat(3,3,CV_32F);
CvMat *dist_coeffs         = cvCreateMat(5,1,CV_32FC1);

//Filling the matrices

double rms_error = cvCalibrateCamera2(cam_object_points,cam_image_points, cam_point_counts, image_size, camera_matrix, dist_coeffs,cam_rotation_vectors,cam_translation_vectors);

I wrote the content of model_points and cam_object_points in a file, they are exactly the same. And image_points also contains the same values as cam_image_points. Those values are obtained using chessboard detection and subpixel corner refinement respectively with c++ and c interface. But I get different results cvCalibrateCamera2 returns a rms error of 0.1 on my data and calibrateCamera returns an error of 0.8 with a different camera matrix whose values are not completely out of the expected range but are not as good as those of cvCalibrateCamera2 by far.

Is there a big difference between the two versions that could explain the different results ? Could there be a problem in the way i use these functions.

I can provide more information on request (values or whatever) if needed.

Thanks in advance.

Thibault