Ask Your Question
0

After Camera calibration, how do I upload the distortion values?

asked 2013-03-18 15:29:56 -0600

mBuno gravatar image

updated 2013-03-18 15:39:00 -0600

berak gravatar image

what I want to do after camera calibration is: 1.- I know that after calibrating, the distortion values will be saved in two files and supposedly,if I am going to use the same camera I just need to upload those distortion values to my program. Well, my question is how? how do I upload those values as constants in a simple program?how do I use them.

I am doing this because supposedly I will be able to tell from the image the distances in length instead of pixels. Please I need help ASAP. I will really appreciate your help.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-03-18 16:20:28 -0600

berak gravatar image

so, you gathered your camera matrix, and the distortion params, and now you're looking for a way to apply them to your camera img ?

i think, you're looking for undistort()

unfortunately, it's not in the online docs, so grab the refman

edit flag offensive delete link more

Comments

what I got after calibrating my camera were two files, one with the intrinsic matrix, and the other one with the distortion coefficients. So, is the intrinsic matrix the same as the camera matrix?

mBuno gravatar imagemBuno ( 2013-03-18 17:26:55 -0600 )edit

yes it is .

if you're looking for a way to read it back in:

<code>

Mat cm;

FileStorage fs("cam.yml", FileStorage::READ);

fs["M"] >> cm; // no idea about the key, take, what's in your file there!

</code>

berak gravatar imageberak ( 2013-03-18 17:30:42 -0600 )edit

yes I read the reference manual. but I think it would be faster to set those values as constants at the very biginning of the program instead of reading them from the field. I was trying to set them like this, but it didn't work

Mat* cameraMatrix= {8.19086426e+002, 0, 2.62020386e+002,0, 8.19086426e+002, 2.61436218e+002, 0, 0, 1,}

then I tried the following but didn't work either.

Mat* cameraMatrix[9]

cameraMatrix[0]= 8.19086426e+002;
cameraMatrix[1]=0;
cameraMatrix[2]=2.62020386e+002;
cameraMatrix[3]=0;
cameraMatrix[4]=8.19086426e+002;
cameraMatrix[5]=2.61436218e+002;
cameraMatrix[6]=0;
cameraMatrix[7]=0;
cameraMatrix[8]=1;

:/ do you know how to initialize them?

mBuno gravatar imagemBuno ( 2013-03-18 18:14:19 -0600 )edit

`double arr[] = {0.0819, 0, 0.0262, 0, 0.0819, 0.0262, 0, 0, 1};

Mat cm(3,3,CV_64F, arr);`

berak gravatar imageberak ( 2013-03-19 03:50:37 -0600 )edit

Question Tools

Stats

Asked: 2013-03-18 15:29:56 -0600

Seen: 250 times

Last updated: Mar 18 '13