ethz-asl / kalibr

The Kalibr visual-inertial calibration toolbox
Other
4.29k stars 1.4k forks source link

Camera calibration #510

Closed Kaijun101 closed 2 years ago

Kaijun101 commented 2 years ago

Hi guys, i am not too sure what are the value to add in for rectification_matrix and the projection_matrix that is required for my USB camera code. This is my camera result from kalibr.

cam0: cam_overlaps: [] camera_model: ds distortion_coeffs: [] distortion_model: none intrinsics: [-0.008924692942985086, 0.9138075160533852, 420.0386682531036, 419.0136126237458, 303.3523319667734, 244.90890485641165] #(intrinsics vector: [xi alpha fu fv pu pv]) resolution: [640, 480] rostopic: /image_converter/output_image

—————————————————————————— I need to covert it to this format. This is what i put but i am not too sure if i did it correctly.

image_width: 640 image_height: 480 camera_name: usb_cam camera_matrix: rows: 3 cols: 3 data: [357.7808547369238, 0, 329.66778704539, 0, 357.41035237313594, 240.04276942034474, 0, 0, 1] distortion_model: radtan distortion_coefficients: rows: 1 cols: 4 data: [0.012252036342139852, 0.009736785998316986, 0.005191213687411114, 0.0009482505467547185] rectification_matrix: rows: 3 cols: 3 data: [1, 0, 0, 0, 1, 0, 0, 0, 1] projection_matrix: rows: 3 cols: 4 data: [357.7808547369238, 0, 329.66778704539, 0, 0, 357.41035237313594, 240.04276942034474, 0, 0, 0, 1, 0]

goldbattle commented 2 years ago

This likely won't work as your distortion model probably isn't what you "USB camera code" will expect. You are using the ds distortion model which I believe OpenCV does not support. I recommend you take a look at whatever is parsing your config and then go from there.

The rectification_matrix and the projection_matrix only show up for a stereo system if you want to perform rectification and are specific to OpenCV (I believe, could be wrong). The stereo rectify function has details on this: https://docs.opencv.org/4.5.5/d9/d0c/group__calib3d.html#ga617b1685d4059c6040827800e72ad2b6