Ask Your Question
0

Java Calib3d.undistortImage OpenCV 3.0.0-dev

asked 2015-05-07 21:03:40 -0500

Steven P. Goldsmith gravatar image

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 ]
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-05-10 10:33:47 -0500

Steven P. Goldsmith gravatar image

Use Imgproc class instead:

Imgproc.undistort(image, mat, cameraMatrix, distCoeffs, newCameraMtx);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-05-07 21:03:40 -0500

Seen: 978 times

Last updated: May 10 '15