@xuxu I have seen the issue sometimes when the ratio of horizontal_aperture and vert_aperture is not equal to resolution_width and resolution_height as the horizontal_aperture and vert_aperture USD attributes are pre-filled with default values.
OPTION 1
Usually, that gets fixed once I set a camera as the active camera for that viewport.
import omni
viewport_handle_1 = omni.kit.viewport.get_viewport_interface().get_instance("Viewport")
viewport_window_1 = omni.kit.viewport.get_viewport_interface().get_viewport_window(viewport_handle_1)
viewport_window_1.set_active_camera("/World/Camera")
After you set the active camera using the above script and then read USD attributes, the ratio of horizontal_aperture and vert_aperture will be equal to resolution_width and resolution_height
OPTION 2
Calculate vertical_aperature as follows vert_aperture = height/width * horiz_aperture