rust-cv / cv

Rust CV mono-repo. Contains pure-Rust dependencies which attempt to encapsulate the capability of OpenCV, OpenMVG, and vSLAM frameworks in a cohesive set of APIs.
792 stars 62 forks source link

Calibrate camera for distorsion #57

Open ironsilk opened 1 year ago

ironsilk commented 1 year ago

Hi,

I'm trying to calibrate a camera against what i believe to be radial distortion. With openCV the method used is calibrateCamera (link). Which usually requires you to use a chessboard pattern in order to identify the actual points and automatically calculate where they should be. I have manually constructed 6 pairs of these points.

My question is how do we achieve this using rust-cv? It is implemented? I've found something similar in the dlt crate but the output is a 4x3 matrix and i can't really make sense of it. (More details on what i've tried be found here)

Any help in deeply appreciated.

Disclaimer: I've been reading for about 2 days and decided to open an issue to you guys , maybe it will also be useful for someone else who's looking for this in the future.

astraw commented 1 year ago

dlt author here. The main function returns a 3x4 matrix as you can see in the docs. dlt does not try to estimate radial distortion. There are various implementations of such around. One is my opencv-calibrate crate which is not (yet) published to crates.io but you are welcome to use, of course.

(I had this stuff written before I was aware of the rust-cv org and keep it maintained but really should integrate with rust-cv, improving it as necessary.)

ironsilk commented 1 year ago

@astraw Thanks! I was looking to build everything without relying on openCV at all, just using rust-cv which as i saw has no dependencies related to opencv. Thanks again!