2

I was learning OpenCV to calibrate and rectify a camera. The camera is already calibrated and now I am using cvRemap(src, dst, mapx, mapy) to un-distort the two images taken by the left and right cameras.

Each time the program runs to the line containing cvRemap(), it throws an unhandled exception called:

Unhandled exception at 0x757dc41f in testagain.exe: Microsoft C++ exception: cv::Exception at memory location 0x003fe73c..

And the console says:

OpenCV Error: Assertion failed (src.type() == dst.type() && dst.size() == mapx.size()) in unknown function, file ..\ ..\ ..\src\opencv\modules\imgproc\src\imgwarp.cpp, line 3294

I did it according to Learning OpenCV. Note that the format of cvRemap is: cvRemap(const CvMat* src, const CvMat* dst, const CvMat* mapx, const CvMat* mapy). Some guesses here:

  1. Since the mapx and mapy are generated by another program and read in by myself, there contain some negative values and some values larger than the resolution of picture(640*480), I manually processed these values and set them back to the range of resolution. I hope this won't be a problem.

  2. Before this trial, I calculated mapx and mapy through cvInitUndistortRectifyMap(), and when I called cvRemap, there is no exception. I don't know why.

KatieK
  • 13,586
  • 17
  • 76
  • 90

0 Answers0