Hi everyone,
I’m using Mech-eye Pro M with Halcon. My question is related to surface 3D object normals. As you can see in the code, I can extract the data with no issues, but when I try to use the extracted normals their orientation seems off as they all point almost to the same direction. The visualization using Halcon Object Model Inspect shows the normals pointing in the expected directions, but the x, y, z, vector tuples don’t seem right. I’m using the box 3D object to visualize the normals.
xyz_to_object_model_3d (ImageReducedX, ImageReducedY, ImageReducedZ, ObjectModel3DScene)
smooth_object_model_3d (ObjectModel3DScene, ‘mls’, ‘mls_kNN’, 2000, SmoothObjectModel3D)
get_object_model_3d_params (SmoothObjectModel3D, ‘point_coord_x’, GenParamValue)
get_object_model_3d_params (SmoothObjectModel3D, ‘point_coord_y’, GenParamValueY)
get_object_model_3d_params (SmoothObjectModel3D, ‘point_coord_z’, GenParamValueZ)
get_object_model_3d_params (SmoothObjectModel3D, ‘point_normal_x’, NormalPointX)
get_object_model_3d_params (SmoothObjectModel3D, ‘point_normal_y’, NormalPointY)
get_object_model_3d_params (SmoothObjectModel3D, ‘point_normal_z’, NormalPointZ)
for i:=0 to (Length-1) by 1
RobotPose[0] := GenParamValue[i]
RobotPose[1] := GenParamValueY[i]
RobotPose[2] := GenParamValueZ[i]
normal_x := NormalPointX[i]
normal_y := NormalPointY[i]
normal_z := NormalPointZ[i]
tuple_acos (normal_x, u)
tuple_acos (normal_y, v)
tuple_acos (normal_z, w)
tuple_deg (u, U)
tuple_deg (v, V)
tuple_deg (w, W)
create_pose (0, 0, 0, U, V, W, 'Rp+T', 'abg', 'point', PoseNormal)
RobotPose[3] := U
RobotPose[4] := V
RobotPose[5] := W
tuple_string(RobotPose,'-10.3f',stringTuple)
RC7_command := stringTuple[0] + ',' + stringTuple[1] + ',' +stringTuple[2] + ',' + stringTuple[3] + ',' + stringTuple[4] + ',' +stringTuple[5]
fwrite_string (FileHandle, RC7_command)
fnew_line (FileHandle)
create_pose(GenParamValue[i],GenParamValueY[i],GenParamValueZ[i], U, V, W, 'Rp+T', 'abg', 'point', Pose1)
gen_box_object_model_3d (Pose1, 1, 3, 6, ObjectModel3D)
visualize_object_model_3d(WindowHandle3d, [ObjectModel3D,SmoothObjectModel3D ], [], [], ['color_1','color_0'], ['white','red'], [], [], [], PoseOut)
endfor