Ask Your Question

Revision history [back]

Java Calib3d.undistortImage OpenCV 3.0.0-dev

I'm able to run through frames and use calibrate methods in Calib3d, but when I call:

Calib3d.undistortImage(image, mat, newCameraMtx, distCoeffs);

I get:

Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: /home/sgoldsmith/opencv-3.0.0/modules/calib3d/src/fisheye.cpp:409: error: (-215) (P.depth() == CV_32F || P.depth() == CV_64F) && (R.depth() == CV_32F || R.depth() == CV_64F) in function initUndistortRectifyMap ]

Looking at fisheye.cpp I see where it's failing the assertion:

CV_Assert((P.depth() == CV_32F || P.depth() == CV_64F) && (R.depth() == CV_32F || R.depth() == CV_64F));

and Java is calling:

private static native void undistortImage_1(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj);

It looks like P and R are not being passed or are incorrect format?

My parameters:

image: Mat [ 480*640*CV_8UC1, isCont=true, isSubmat=false, nativeObj=0x7f2088225040, dataAddr=0x7f2088536330 ]
newCameraMtx: Mat [ 3*3*CV_64FC1, isCont=true, isSubmat=false, nativeObj=0x7f2088226920, dataAddr=0x7f2088224fe0 ]
distCoeffs: Mat [ 5*1*CV_64FC1, isCont=true, isSubmat=false, nativeObj=0x7f2088285dd0, dataAddr=0x7f2088287e10 ]