vwertuzy
vwertuzy

Reputation: 211

How to convert Matlab's fisheye calibration results into OpenCV format?

I am using Matlab's Camera Calibrator to calibrate a bunch of images from a fisheye camera.

How can I translate the results into OpenCV format?

Results in Matlab:

enter image description here

Format I would like to convert them to:

enter image description here enter image description here

I looked into and found out that Scaramuzza's model is the one that the Matlab fisheye calibration uses, but I don't see clearly anywhere what exactly each value stands for, or the order.

Edit: The cameraIntrinsicsToOpenCV function provided by Matlab does not work with fisheye models, it is only for pinhole/default camera model, hence the question!

Upvotes: 1

Views: 1554

Answers (1)

Blue Giant
Blue Giant

Reputation: 75

From version R2021b, Matlab has introduced the cameraIntrinsicsToOpenCV function which does exactly that. Read more here

They also made it bijective with its twin function cameraIntrinsicsFromOpenCV.

Edit: For fisheye cameras, use undistortFisheyeImage function to get the cameraIntrinsics which will contain all the data for opencv: FocalLength [fx fy] , PrincipalPoint [cx, cy], RadialDistortion [k1 k2 k3] and TangentialDistortion [p1 p2].

[UndistortedImage,camIntrinsics] = undistortFisheyeImage(Image,intrinsics);

Upvotes: 1

Related Questions