Halcon学习笔记:select_points_object_model_3d 3D对象模型阀值分割
-
This example program shows how to use the operators
-
connection_object_model_3d and select_object_model_3d
-
in HALCON. First, a threshold is applied to the 3D object
-
model. Then, the connected components are calculated
-
based on the geometric distance. Finally, the connected
-
components are selected by their volume and diameter and
-
the result is displayed.
-
这个示例程序展示了如何在HALCON中使用connection_object_model_3d和select_object_model_3d操作符。
-
首先,对3D对象模型应用一个阈值。然后,根据几何距离计算连通分量。
-
最后,根据连接部件的体积和直径选择连接部件并显示结果。
源码:
dev_update_off ()
dev_close_window ()
* 1、加载X,Y, z数据,缩放到米,并生成一个3D对象模型
ImagePath := 'time_of_flight/'
read_image (Image, ImagePath + 'engine_cover_xyz_01')
* 缩放图像的灰度值
* 将图像放大一个给定的倍数
scale_image (Image, Image, .001, .0)
zoom_image_factor (Image, Image, 2, 2, 'constant')
decompose3 (Image, X, Y, Z)
xyz_to_object_model_3d (X, Y, Z, ObjectModel3DID)
* 2、计算模型的网格(Delaunay三角测量)
* 为'segmentation',准备一个3D对象模型(如果要对同一操作多次使用3D对象模型,这样做会更快)
prepare_object_model_3d (ObjectModel3DID, 'segmentation', 'true', [], [])
*
* 3、准备可视化并显示3D对象模型
create_pose (0.058, -0.165, 0.660, 345.0, 355.0, 356.0, 'Rp+T', 'gba', 'point', Pose)
*
* Instructions for visualize_object_model_3d
Instructions[0] := 'Rotate: Left button'
Instructions[1] := 'Zoom: Shift + left button'
Instructions[2] := 'Move: Ctrl + left button'
* Configuration
gen_cam_par_area_scan_division (0.01, 0, 7e-6, 7e-6, 352, 288, 710, 576, CamParam)
GenParamName := ['color','disp_pose','alpha']
GenParamValue :