menandro / vfs

Variational Fisheye Stereo
49 stars 18 forks source link

Calibrate custom camera #9

Open TheRealKaufmann opened 3 years ago

TheRealKaufmann commented 3 years ago

Hi there,

I really like the VFS-Project and would like to use it with a custom camera and a 180 degree fisheye lens. How would I go about this? What would I have to do in regards to calibration and setup?

Thanks, Tom

menandro commented 3 years ago

My code can solve the disparity given only the trajectory and calibration fields. I linked a GIST Matlab script in Readme for generating the fields given the intrinsic and extrinsic calibration parameters. However, I only have the Kannala-Brandt (KB) model for this.

03/18/2020: Added link for MATLAB scipts generating the vector fields KB model Equidistant model

Just replace these lines with your model:

% Calibration data from T265
K0 = [285.722 0 420.135; 0 286.759 403.394; 0 0 1];
D0 = [-0.00659769 0.0473251 -0.0458264 0.00897725 0];
K1 = [284.936 0 428.136; 0 286.006 398.921; 0 0 1];
D1 = [-0.00492777 0.0391601 -0.0353147 0.0051312 0];
R = [0.999985 0.00061035 -0.00553418;
-0.00058935 0.999993 0.00379553;
0.00553646 -0.00379221 0.999977];
t = [-0.0641854; -0.000218299; 0.000111253];

I suppose a 180degree fisheye camera might require a different model (like Universal Camera Model) but I don't know how to do the calibration for that. If you can ignore the curvature at extreme angles, then KB model is okay. OpenCV has a calibration method for finding the intrinsic matrices (K and distortion D).

For the extrinsic matrix (R, t) that depends. You didn't say if you're using a monocular camera or a stereo camera. Stereo is straightforward (OpenCV) but monocular is a little bit hard (scale problem).

So, once you have the intrinsic and extrinsic matrices (K, D, R, t), you can use my Matlab script to generate the translation and calibration vectors and then use that for the code.

TheRealKaufmann commented 3 years ago

Wow thank you so much for your detailed answer! If I would get values from a universal camera calibration for example or other calibration models, could I just use them in your MATLAB Script or would I have to write a own script to generate vector fields for that?