Set exact intrinsic matrix of camera fails

Hi @roth.pascal - The intrinsic matrix you provided seems to be in the format of:

fx  0  cx
0  fy  cy
0   0   1

The horizontal_aperture, vertical_aperture, horizontal_aperture_offset, and vertical_aperture_offset parameters in USD are used to define the camera’s field of view and the lens shift. These parameters are not directly equivalent to the intrinsic parameters fx, fy, cx, and cy.

The horizontal_aperture and vertical_aperture parameters in USD are defined in millimeters, and they represent the size of the camera’s film back. The horizontal_aperture_offset and vertical_aperture_offset parameters represent the lens shift, which is the offset of the lens from the center of the film back.

To convert from the intrinsic parameters to the USD parameters, you can use the following formulas:

horizontal_aperture = image_width_in_pixels * pixel_size_in_mm / fx
vertical_aperture = image_height_in_pixels * pixel_size_in_mm / fy
horizontal_aperture_offset = (cx - image_width_in_pixels / 2) * pixel_size_in_mm
vertical_aperture_offset = (cy - image_height_in_pixels / 2) * pixel_size_in_mm

Here, pixel_size_in_mm is the size of a pixel in millimeters. This value depends on the specific camera sensor you are using, and you would need to look up this value in the camera’s specifications.

Please note that these formulas assume that the camera’s coordinate system is right-handed with the x-axis pointing to the right, the y-axis pointing up, and the z-axis pointing towards the viewer. If your camera’s coordinate system is different, you might need to adjust the formulas accordingly.

Also, please note that the horizontal_aperture_offset and vertical_aperture_offset parameters in USD represent the lens shift, which is a relatively small effect that is usually only noticeable in wide-angle lenses or when using a tilt-shift lens. If you are not seeing a noticeable effect when changing these parameters, it might be because your camera’s field of view is not wide enough, or because the lens shift is too small to be noticeable.