First time here? Check out the FAQ!

Ask Your Question
0

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

asked Oct 20 '13

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.

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Oct 21 '13

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 );

Preview: (hide)

Question Tools

Stats

Asked: Oct 20 '13

Seen: 1,521 times

Last updated: Oct 21 '13