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.

有帮助吗?

解决方案

First , Load the intrinsic distortion in xml file.

Then , Use the code like blow to rectify the raw image.

IplImage* mapx = cvCreateImage( cvGetSize(image), IPL_DEPTH_32F, 1 );
IplImage* mapy = cvCreateImage( cvGetSize(image), IPL_DEPTH_32F, 1 );
  cvInitUndistortMap(
    intrinsic,
    distortion,
    mapx,
    mapy
  );
IplImage *t = cvCloneImage(image);
cvShowImage( "Raw Video", image ); // Show raw image
cvRemap( t, image, mapx, mapy );     // Undistort image
cvShowImage("Undistort", image);     // Show corrected image

If you have installed OpenCV , some sample code can been find in opencv2.4.x\samples\cpp , this part often in the calibration program.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top