[ros-users] opencv assertion failure with PinholeCameraModel::rectifyPoint

David Feil-Seifer david.feilseifer at gmail.com
Sun May 2 10:16:29 UTC 2010

When using the PinholeCameraModel class, I'm getting the following
runtime error:

OpenCV Error: Assertion failed (src.isContinuous() && src.depth() ==
CV_32F && ((src.rows == 1 && src.channels() == 2) ||
src.cols*src.channels() == 2)) in undistortPoints, file
line 383

with the following code:

          cv::Point2d uv;
          uv.x = b.x; uv.y = b.y; //valid image coords
          cv::Point2d uvrect;
          pcam_.rectifyPoint( uv, uvrect );

I made this error go away when I changed the rectifyPoint section to
the following:

  const cv::Mat src_pt(1, 1, CV_32FC2, const_cast<double*>(&uv_raw.x));
  cv::Mat dst_pt(1, 1, CV_32FC2, &uv_rect.x);
  cv::undistortPoints(src_pt, dst_pt, K_, D_, R_, P_);

where CV_32FC2 used to be CV_64FC2

I am using box_turtle release (updated today) with Ubuntu 10.04.

My question is, was this a bug in the image_geometry package, or was
my code wrong?

Thanks as always,

More information about the ros-users mailing list