Assertion failure durring defishing in initUndistortRectifyMap
I'm trying to do fish an image by providing "camera_matrix" and "distortion_coefficients" to cv::fisheye::undistortImage. problem is I'm getting Assertion error. Reason is the distortion coefficients which i'm getting through camera calibration are 5x1
<distortion_coefficients type_id="opencv-matrix">
<rows>5</rows>
<cols>1</cols>
<dt>d</dt>
<data>
-2.0834245161331000e-01 5.8179563841609050e-02 0. 0.
-8.0440183287724919e-03</data></distortion_coefficients>
but undistortImage
method accepts 4X1 distortion matrix. Any idea whats the way around to this problem
Following is the error which I'm getting
'error: (-215) K.size() == Size(3, 3) && (D.empty() || D.total() == 4) in function initUndistortRectifyMap'
how did you achieve those dist coeffs ?
(my guess is, you have to use a fisheye calibration as well, not the ordinary one.)
I used "opencv/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp" script.
try to enable it here: https://github.com/opencv/opencv/blob...
It worked like a charm. Can you write it as an answer so then i can mark it. One more thing. After applying the distortion I'm loosing some of the image (Is there a way to avoid that).
"loosing some of the images" - means ?
origional
undistorted
I was acceding my comment limit so i had to divide it in two. If you see I'm loosing some of the image in undistorted version. Any idea how to avoid it.
^^ url fail.
do you mean, that undistorting removes part of the image ? that's kinda unavoidable. all you can do is try the best calibration possible (least rms)
(iirc, undistort also returns the regions, which are still valid in the image.)
origionalundistorted Can you check again