Reputation: 77
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.
Upvotes: 0
Views: 1125
Reputation: 26
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.
Upvotes: 1