Halcon - Shift coordinates to a different plane

197 Views Asked by At

I have coordinates (X/Y) that are relative to a specific Plane on a pose.

I would need to know how the Y value changes, if the Point would be projected to another Plane from the camera's view, that is located 10 mm further away in Z direction.

The only way I found is to convert my X/Y points to Image coordinates with project_3d_point and then convert it back to world coordinates using a z-shifted pose. Problem with that is that the image resolution is too low to have precise values. can this be calculated without using the image coordinates? In the picture I have Y1 and Y2 and would need Y3 and Y4.

enter image description here

EDIT:

This is something else I tried to solve this, but I am pretty sure that its rubbish:

calculation pose is the pose at the pose at the origin. Z=0.01

             set_origin_pose (CalculationPose, 0, 0, Z, ZShiftedPose)
             
             pose_to_hom_mat3d(ZShiftedPose, HomMat3D)   
             
             projective_trans_point_3d( HomMat3D, 0, Y1, 0, dummy, ZY1, dummy)

EDIT 2:

this works, but it is veeeery ugly. Is there a smarter and nicer way to solve this?

             set_origin_pose (CalculationPose, 0, 0, Z, ZShiftedPose)
             
             pose_to_hom_mat3d(CalculationPose, HomMat3DCalc)           
             pose_to_hom_mat3d(ZShiftedPose, HomMat3DShift)  

             affine_trans_point_3d(HomMat3DCalc, 0, Y1, Z, a, b, c)                 
             project_3d_point( a, b, c, CameraParam , Row, Column)
             image_points_to_world_plane(CameraParam, CalculationPose,Row,Column,'mm',dummy,Y3)
             
            
1

There are 1 best solutions below

0
On

try this:

* -----------
* Data simulation
* -----------

* Camera Pose
TransX := 0
TransY := -0.5
TransZ := 1
RotX := 30
RotY := 0
RotZ := 0
OrderOfTransform := 'Rp+T'
OrderOfRotation := 'gba'
ViewOfTransform  := 'point'

create_pose (TransX, TransY, TransZ, RotX, RotY, RotZ, OrderOfTransform , OrderOfRotation, ViewOfTransform , CamPose)

Focal_m := 0.00173333
PixelSize_m :=5.2e-006
CameraParam := [Focal_m, 0, PixelSize_m , PixelSize_m , 640, 512, 1280, 1024]

* Point1 with world coordinate system
Xw1 :=0
Yw1 :=0.2
Zw1 :=0

* -----------
* Calculation
* -----------

* Focal Point with world coordinate system
Xfocalw := -CamPose[0]
Yfocalw := -CamPose[1]
Zfocalw := -CamPose[2]

Zw3 :=0.1
Xw3 := 1.0*(Xw1-Xfocalw)/(Zw1-Zfocalw)*(Zw3-Zw1)+Xw1
Yw3 := 1.0*(Yw1-Yfocalw)/(Zw1-Zfocalw)*(Zw3-Zw1)+Yw1