zivid-python icon indicating copy to clipboard operation
zivid-python copied to clipboard

Better documentation for Camera Intrinsics and Distortion parameters.

Open TommasoBendinelli opened this issue 3 years ago • 7 comments

Hello, I have just stumbled into these file: https://github.com/zivid/zivid-python/blob/master/modules/zivid/camera_intrinsics.py Camera Instrinsics and Distortion parameters are quite useful for a lot of applications and should be documented better.

Best

TommasoBendinelli avatar Jul 26 '22 09:07 TommasoBendinelli

Hi!

First of all, if you are wondering how to retrieve intrinsics from a camera, look here: https://github.com/zivid/zivid-python/blob/master/modules/zivid/experimental/calibration.py

If you are looking for documentation on how to interpret the values, then I agree it could be better. Long story short, it is the "Standard OpenCV model" intrinsics: https://docs.opencv.org/4.x/dc/dbb/tutorial_py_calibration.html

eskaur avatar Jul 26 '22 11:07 eskaur

I tried to match the parameters got from Zivid calibration.py against the one I have obtained with CalibrateCamera from OpenCV and the parameter values are completely different. Are unit of measurements different somehow?

TommasoBendinelli avatar Jul 27 '22 11:07 TommasoBendinelli

Hi Tommaso!

There should be no difference in units. The Brown distortion model uses unitless parameters that work in normalized coordinates.

Can you share the two sets of parameters for reference?

diviz-imas avatar Jul 28 '22 09:07 diviz-imas

Actually, it was an issue on my side. Sorry about that. I made a small bug in the code, which resulted in wrong values. Now my values and the ones from Zivid SDK are much closer: Zivid: {"_k1": -0.08929276466369629, "_k2": 0.11623617261648178, "_k3": -0.03393297642469406, "_p1": -0.0004479888884816319, "_p2": -0.00011812106822617352, "_cx": 969.7472534179688, "_cy": 592.1499633789062, "_fx": 1778.913330078125, "_fy": 1778.9261474609375} OpenCV: {"_k1": -0.07816818141757419, "_k2": 0.06866144436678583, "_k3": -0.024689114436057036, "_p1": 0.00016911156978288228, "_p2": -0.0004692102909033517, "_cx": 959.6700426181453, "_cy": 592.86066030548, "_fx": 1,776.7353645734295, "_fy": 1,779.8388818694884}

How are the Zivid values computed? Are these parameters uniquely computed for each Zivid camera you produce, or are they fixed for all Zivid II cameras? I am wondering whether I should trust the ones obtained from the Zivid SDK more, or the ones that I compute via calibration. Thanks!

TommasoBendinelli avatar Jul 28 '22 13:07 TommasoBendinelli

All Zivid cameras are individually calibrated over a wide range of temperatures and aperture values with a high-end calibration process and custom algorithms. My recommendation is to trust the ones from Zivid SDK.

diviz-imas avatar Jul 28 '22 13:07 diviz-imas

Thanks for this relevant info! It would make sense to add it into the documentation

TommasoBendinelli avatar Jul 28 '22 13:07 TommasoBendinelli

Thanks for the feedback Tommaso. We'll see what we can do to improve the docs.

diviz-imas avatar Jul 28 '22 14:07 diviz-imas