Computing pixel focal length for ROS camera based on resolution + mm focalLength

My ROS camera prim publishes CameraInfo to /camera_info, as in the example code. That message contains a camera intrinsics matrix, which contains the principal point’s pixel coordinates as well as the focal length in pixels. How is that pixel focal length computed based on the focal length (in mm) of the camera prim object with attribute focalLength and the camera’s resolution? I see that it seems to be linearly proportional to the mm focalLength, but I’m not sure how the scale factor is computed.

focal_x = height * focal_length / vert_aperture
focal_y = width * focal_length / horiz_aperture

From Change intrinsic camera parameters - #6 by Hammad_M

1 Like