uzh-rpg / flightmare

An Open Flexible Quadrotor Simulator
https://uzh-rpg.github.io/flightmare/
Other
996 stars 344 forks source link

callibration matrix for unity #48

Open vanshilshah97 opened 3 years ago

vanshilshah97 commented 3 years ago

How would be able to extract callibration matrix from unity ?

yun-long commented 3 years ago

Hi, you don't extract the calibration matrix from Unity, instead, it is calculated on the client-side (ROS/C++).

Since both the image dimensions (width x height) and field of view (FOV) are defined by the user. (see https://github.com/uzh-rpg/flightmare/blob/master/flightlib/include/flightlib/sensors/rgb_camera.hpp#L59-L61)

you can compute the focal length using this formula: f = ( image.height / 2.0 ) / tan( (M_PI * FOV/180.0 )/2.0 ) and fx=fy. Hence, the camera intrinsic matrix is[ [fx, 0, image.width/2], [0, fy, image.height/2], [0, 0, 1] ].