Ask Your Question
0

Using camera calibration parameters in a real-time video capture application

asked 2013-10-20 08:42:02 -0600

So, I am capturing a video from a cheap usb web-cam. I then compute optic flow from this feed. I am finally using these optic-flow measurements for (monocular) robot navigation. I have calibrated my camera and have the intrinsic and distortion parameters in two separate xml files. My question is, how do I use these parameters in my video capture code now. If somebody could please show this using a code/pueudo-code, that would be very helpful.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2013-10-21 03:25:18 -0600

antonio gravatar image

Here are the three main steps you should follow after you've saved the intr./extr. params in xml files (I'm using C routines):

  1. Parameters should be loaded back in a matrix.

    CvMat intrinsic = (CvMat)cvLoad(“Intrinsics.xml”);

    CvMat distortion = (CvMat)cvLoad(“Distortion.xml”);

  2. Build the undistort map that will be used for all subsequent frames.

    IplImage* mapx = cvCreateImage( cvGetSize(image), IPL_DEPTH_32F, 1 );

    IplImage* mapy = cvCreateImage( cvGetSize(image), IPL_DEPTH_32F, 1 );

    cvInitUndistortMap(intrinsic, distortion, mapx, mapy);

  3. Undistort the initial image (say imin).

    cvRemap( imin, imundist mapx, mapy );

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-10-20 08:42:02 -0600

Seen: 1,447 times

Last updated: Oct 21 '13