Ask Your Question

al's profile - activity

2013-06-21 12:32:55 -0500 commented question Undistort single channel images

Alright, I got it "working". The problem was in my haste, I was mixing C style and C++ style interfaces. Compiles and runs but the recitified image is very very wrong. I've checked the intrinsic and distortion Mats and they look OK....

2013-06-21 11:35:26 -0500 commented question Undistort single channel images

Thanks for the comment. I somehow thought size is number of bytes. The issue is that I get this executing the above code:

terminate called after throwing an instance of 'cv::Exception' what(): /tmp/buildd/ros-fuerte-opencv2-2.4.2-1precise-20130312-1306/modules/imgproc/src/imgwarp.cpp:3294: error: (-215) src.type() == dst.type() && dst.size() == mapx.size() in function cvRemap

2013-06-20 21:21:42 -0500 received badge  Editor (source)
2013-06-20 21:19:22 -0500 asked a question Undistort single channel images

How can one rectify single channel images?

It seems cvInitUndistortRectifyMap wants mapx and mapy only in CV_16SC2 or it's 32F format. Further one, when I want to use cvremap:

mapx = cvCreateMat( 640, 480,CV_16SC2);
mapy = cvCreateMat( 640, 480, CV_16UC1);
IplImage* im = cvCreateImage(cvSize(640,480),IPL_DEPTH_8U, 1);
IplImage* rim = cvCreateImage(cvSize(640,480),IPL_DEPTH_8U, 1);
im->imageData = (char*) data->fisheye_image;

cvRemap(im, rim,
         mapx, mapy,

When running the above, cvRemap complains saying that rim.size() and mapx.size() should be the same (which is stated in the doc. as well). However, rim is a single channel 8bit image, and mapx cannot be the same size.

Surely, there should be a way. How does one undistorts single channel images?