Hi everyone,
I’m trying to convert a 3D point into 2D image coordinates in order to plot the target point onto the camera image. However, the projected point doesn’t appear in the correct position — it seems to be offset.
Here’s the code snippet I’m using:
calibration_params = camera.get_camera_information().camera_configuration.calibration_parameters.left_cam
fx = calibration_params.fx
fy = calibration_params.fy
cx = calibration_params.cx
cy = calibration_params.cy
u = (x / z) * fx + cx
v = (y / z) * fy + cy
x_plot = int(u * self.viewer_objects[“image_scale”][0])
y_plot = int(v * self.viewer_objects[“image_scale”][1])
cv2.circle(self.viewer_objects[“image_left_ocv”], (x_plot, y_plot), 3, (0, 80, 255), -1)
As far as I know, the projection formula (pinhole model) should be correct, but the point does not match the expected location in the image.
Could someone help me figure out what I might be missing?
Could it be related to the coordinate system origin, the use of image_scale?
Any insights would be greatly appreciated!