一、简介

三维重建(3D Reconstruction)技术一直是计算机图形学和计算机视觉领域的一个热点课题。早期的三维重建技术通常以二维图像作为输入,重建出场景中的三维模型。但是,受限于输入的数据,重建出的三维模型通常不够完整,而且真实感较低。随着各种面向普通消费者的深度相机(depth camera)的出现,基于深度相机的三维扫描和重建技术得到了飞速发展。

二、算子解释

1、为 3D 对象模型创建表面三角剖分。 triangulate_object_model_3d

*3D 对象模型 ObjectModel3D 生成三角形面的表面,并在 TriangulatedObjectModel3D 中返回结果表面
*ObjectModel3D
*
*Method 三种三角剖分方法:
*           'greedy',
*           'implicit',
*           'polygon_triangulation'(多边形三角剖分)
*
*GenParamName 通用三角测量参数的名称
*         'greedy_fix_flips':启用/禁用算法的翻转解决步骤 ---- true' (default), 'false
*         'greedy_hole_filling':设置应考虑用于孔填充的表面边界长度(以点顶点数计)。如果指定了“false”,则禁用孔填充步骤
*         'greedy_kNN':指定邻域的大小 k。在寻找表面边界点的可达 SNC 邻居时,该算法仅考虑其最近的 k 个邻居
*         'greedy_mesh_dilation':指定膨胀周期数。在网格腐蚀之后应用网格膨胀。如果 'greedy_mesh_dilation' 设置为大于 'greedy_mesh_erosion' 的值,它将在内部减少为 'greedy_mesh_erosion' 的值。
*         'greedy_mesh_erosion':指定膨胀周期数。在网格腐蚀之后应用网格膨胀。如果 'greedy_mesh_dilation' 设置为大于 'greedy_mesh_erosion' 的值,它将在内部减少为 'greedy_mesh_erosion' 的值。
*         'greedy_neigh_latitude_tol',
*         'greedy_neigh_orient_consistent',
*         'greedy_neigh_orient_tol',
*         'greedy_neigh_vertical_tol',
*         'greedy_prefetch_neighbors',
*         'greedy_radius_type':如果设置为 'fixed','greedy_radius_value' 以米为单位指定 SNC 半径 r。
*                               如果设置为“z_factor”,则通过将其 z 坐标乘以“greedy_radius_value”指定的值来计算每个点 P 的 r。 r 的这种表示适用于点的密度与它们与记录它们的传感器的距离相关的数据。这通常是深度传感器或 TOF 相机的情况。
*                               如果设置为“auto”,算法会在内部确定是使用“fixed”还是“z_factor”半径并估计其值。然后将估计值乘以“greedy_radius_value”中指定的值。这样,用户指定估计半径的比例因子。
*                               值列表:'auto'(默认)、'fixed'、'z_factor'
*         'greedy_radius_value':0.01, 0.05, 0.5, 0.66, 1.0, 1.5, 2.0, 3.0, 4.0
*         'greedy_remove_small_surfaces',
*         'greedy_suppress_timeout_error',
*         'greedy_timeout',
*         'implicit_min_num_samples',
*         'information' *3D 对象模型 ObjectModel3D 生成三角形面的表面,并在 TriangulatedObjectModel3D 中返回结果表面
*ObjectModel3D
*
*Method 三种三角剖分方法:
*           'greedy',
*           'implicit',
*           'polygon_triangulation'(多边形三角剖分)
*
*GenParamName 通用三角测量参数的名称
*         'greedy_fix_flips':启用/禁用算法的翻转解决步骤 ---- true' (default), 'false
*         'greedy_hole_filling':设置应考虑用于孔填充的表面边界长度(以点顶点数计)。如果指定了“false”,则禁用孔填充步骤
*         'greedy_kNN':指定邻域的大小 k。在寻找表面边界点的可达 SNC 邻居时,该算法仅考虑其最近的 k 个邻居
*         'greedy_mesh_dilation':指定膨胀周期数。在网格腐蚀之后应用网格膨胀。如果 'greedy_mesh_dilation' 设置为大于 'greedy_mesh_erosion' 的值,它将在内部减少为 'greedy_mesh_erosion' 的值。
*         'greedy_mesh_erosion':指定膨胀周期数。在网格腐蚀之后应用网格膨胀。如果 'greedy_mesh_dilation' 设置为大于 'greedy_mesh_erosion' 的值,它将在内部减少为 'greedy_mesh_erosion' 的值。
*         'greedy_neigh_latitude_tol',
*         'greedy_neigh_orient_consistent',
*         'greedy_neigh_orient_tol',
*         'greedy_neigh_vertical_tol',
*         'greedy_prefetch_neighbors',
*         'greedy_radius_type':如果设置为 'fixed','greedy_radius_value' 以米为单位指定 SNC 半径 r。
*                               如果设置为“z_factor”,则通过将其 z 坐标乘以“greedy_radius_value”指定的值来计算每个点 P 的 r。 r 的这种表示适用于点的密度与它们与记录它们的传感器的距离相关的数据。这通常是深度传感器或 TOF 相机的情况。
*                               如果设置为“auto”,算法会在内部确定是使用“fixed”还是“z_factor”半径并估计其值。然后将估计值乘以“greedy_radius_value”中指定的值。这样,用户指定估计半径的比例因子。
*                               值列表:'auto'(默认)、'fixed'、'z_factor'
*         'greedy_radius_value':0.01, 0.05, 0.5, 0.66, 1.0, 1.5, 2.0, 3.0, 4.0
*         'greedy_remove_small_surfaces',
*         'greedy_suppress_timeout_error',
*         'greedy_timeout',
*         'implicit_min_num_samples',
*         'information':  默认情况下('information'='num_triangles'),报告生成的三角形的数量。对于 'information'='verbose',返回名称-值信息对列表
*         'implicit_octree_depth':设置八叉树的深度。八叉树深度控制表面生成的分辨率 - 深度越高,表面分辨率越高。八叉树深度对运行时间有指数影响,对八叉树的内存需求有指数影响。因此,深度限制为 12。
*        'implicit_solver_depth':启用替代算法,该算法可以在原始算法接管其余计算之前将隐式函数准备到用户指定的八叉树深度。这个算法比原来的算法需要更少的内存,但速度有点慢。
*GenParamValue 通用三角测量参数的值: 6, 8, 12, 'true', 'false', 'auto', 'fixed', 'z_factor', 'verbose', 'num_triangles'
*
*TriangulatedObjectModel3D 具有三角形表面的 3D 对象模型的句柄
**         'implicit_octree_depth':设置八叉树的深度。八叉树深度控制表面生成的分辨率 - 深度越高,表面分辨率越高。八叉树深度对运行时间有指数影响,对八叉树的内存需求有指数影响。因此,深度限制为 12。
*        'implicit_solver_depth':启用替代算法,该算法可以在原始算法接管其余计算之前将隐式函数准备到用户指定的八叉树深度。这个算法比原来的算法需要更少的内存,但速度有点慢。
*GenParamValue 通用三角测量参数的值: 6, 8, 12, 'true', 'false', 'auto', 'fixed', 'z_factor', 'verbose', 'num_triangles'
*
*TriangulatedObjectModel3D 具有三角形表面的 3D 对象模型的句柄
*
*Information 默认情况下('information'='num_triangles'),报告生成的三角形的数量。对于 'information'='verbose',返回名称-值信息对列表

三、代码显示

halcon 案例:‘greedy’

*
* This example program demonstrates how to use the operator
* triangulate_object_model_3d
*
*
* Init visualization
dev_close_window ()
dev_update_off ()
dev_open_window (0, 0, 800, 600, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
Instructions[0] := 'Rotate: Left button'
Instructions[1] := 'Zoom:   Shift + left button'
Instructions[2] := 'Move:   Ctrl  + left button'
ForcePause := 1.5
get_system_opengl_supported (WindowHandle, OpenGLSupported)
*
* Overview of all default triangulation parameters (greedy mode):
* 'greedy_kNN' --> 40
* 'greedy_radius_type' --> 'auto'
* 'greedy_radius_value' --> 1.0
* 'greedy_neigh_orient_tol' --> 30
* 'greedy_neigh_orient_consistent' --> 'false'
* 'greedy_neigh_vertical_tol' --> 0.1
* 'greedy_neigh_latitude_tol' --> 30
* 'greedy_hole_filling' --> 40
* 'greedy_fix_flips' --> 'true'
* 'greedy_mesh_erosion' --> 0
* 'greedy_mesh_dilation' --> 0
* 'greedy_remove_small_surfaces' --> 'false'
* 'greedy_prefetch_neighbors' --> 'true'
* 'greedy_timeout' --> 'false'
* 'greedy_suppress_timeout_error' --> 'false'
* 'information' --> 'num_triangles'
*
create_pose (-49.9194, 43.0534, 1343.74, 199.373, 27.1203, 3.17326, 'Rp+T', 'gba', 'point', Pose0)
read_object_model_3d ('mvtec_bunny.om3', 'mm', [], [], ObjectModel3D, Status)
if (OpenGLSupported)SamplingFactor := 0.003MeshMorpologyParams := [4,3,30000]
elseSamplingFactor := 0.0053MeshMorpologyParams := [3,2,300]
endif
* The raw data contains a huge number of points. Although they can
* be triangulated as well, we sample down their number. This has two
* major advantages:
* - both the triangulation and the visualization of the objects are
*   much faster
* - the sub-sampling results in a smoother point cloud and hence -
*   a smoother triangulated surface
get_object_model_3d_params (ObjectModel3D, 'diameter_axis_aligned_bounding_box', Diameter)
*'diameter_axis_aligned_bounding_box'  :3D 点集的直径,定义为最小封闭轴平行长方体的对角线长度(参见参数 'bounding_box1')。该属性的长度为 1。
sample_object_model_3d (ObjectModel3D, 'fast', SamplingFactor * Diameter, [], [], RawPointData3D)
*
* Inspect the point cloud data
visualize_object_model_3d (WindowHandle, RawPointData3D, [], Pose0, 'point_size', 1, 'Raw point data to be triangulated', [], Instructions, Pose)
*
*
* Triangulation with default settings
*
* (Only 'information' is set to 'verbose', to give
* additional informations about the triangulation
* process.)
*
* Display status
DescriptionText := []
ParameterNames := 'information'
ParameterValues := 'verbose'
Status := 'Performing triangulation with default settings ...'
disp_message (WindowHandle, [DescriptionText,Status], 'window', 12, 12, 'black', 'true')
*
* Perform triangulation
count_seconds (Start)
*
triangulate_object_model_3d (RawPointData3D, 'greedy', ParameterNames, ParameterValues, Surface3DDefault, Info)
*3D 对象模型 ObjectModel3D 生成三角形面的表面,并在 TriangulatedObjectModel3D 中返回结果表面
*ObjectModel3D
*
*Method 三种三角剖分方法: 'greedy', 'implicit', 'polygon_triangulation'(多边形三角剖分)
*
*GenParamName 通用三角测量参数的名称
*         'greedy_fix_flips':启用/禁用算法的翻转解决步骤 ---- true' (default), 'false
*         'greedy_hole_filling':设置应考虑用于孔填充的表面边界长度(以点顶点数计)。如果指定了“false”,则禁用孔填充步骤
*         'greedy_kNN':指定邻域的大小 k。在寻找表面边界点的可达 SNC 邻居时,该算法仅考虑其最近的 k 个邻居
*         'greedy_mesh_dilation':指定膨胀周期数。在网格腐蚀之后应用网格膨胀。如果 'greedy_mesh_dilation' 设置为大于 'greedy_mesh_erosion' 的值,它将在内部减少为 'greedy_mesh_erosion' 的值。
*         'greedy_mesh_erosion':指定膨胀周期数。在网格腐蚀之后应用网格膨胀。如果 'greedy_mesh_dilation' 设置为大于 'greedy_mesh_erosion' 的值,它将在内部减少为 'greedy_mesh_erosion' 的值。
*         'greedy_neigh_latitude_tol',
*         'greedy_neigh_orient_consistent',
*         'greedy_neigh_orient_tol',
*         'greedy_neigh_vertical_tol',
*         'greedy_prefetch_neighbors',
*         'greedy_radius_type':如果设置为 'fixed','greedy_radius_value' 以米为单位指定 SNC 半径 r。
*                               如果设置为“z_factor”,则通过将其 z 坐标乘以“greedy_radius_value”指定的值来计算每个点 P 的 r。 r 的这种表示适用于点的密度与它们与记录它们的传感器的距离相关的数据。这通常是深度传感器或 TOF 相机的情况。
*                               如果设置为“auto”,算法会在内部确定是使用“fixed”还是“z_factor”半径并估计其值。然后将估计值乘以“greedy_radius_value”中指定的值。这样,用户指定估计半径的比例因子。
*                               值列表:'auto'(默认)、'fixed'、'z_factor'
*         'greedy_radius_value':0.01, 0.05, 0.5, 0.66, 1.0, 1.5, 2.0, 3.0, 4.0
*         'greedy_remove_small_surfaces',
*         'greedy_suppress_timeout_error',
*         'greedy_timeout',
*         'implicit_min_num_samples',
*         'information'
*         'implicit_octree_depth':设置八叉树的深度。八叉树深度控制表面生成的分辨率 - 深度越高,表面分辨率越高。八叉树深度对运行时间有指数影响,对八叉树的内存需求有指数影响。因此,深度限制为 12。
*        'implicit_solver_depth':启用替代算法,该算法可以在原始算法接管其余计算之前将隐式函数准备到用户指定的八叉树深度。这个算法比原来的算法需要更少的内存,但速度有点慢。
*GenParamValue 通用三角测量参数的值: 6, 8, 12, 'true', 'false', 'auto', 'fixed', 'z_factor', 'verbose', 'num_triangles'
*
*TriangulatedObjectModel3D 具有三角形表面的 3D 对象模型的句柄
*
*Information 默认情况下('information'='num_triangles'),报告生成的三角形的数量。对于 'information'='verbose',返回名称-值信息对列表
count_seconds (End)
TimeDefault := End - Start
force_pause (TimeDefault, ForcePause)
* If 'information' is set to 'verbose', a lot of useful
* information is returned by triangulate_object_model_3d
* dev_inspect_ctrl (Info)
*
* Display results
VisParNames := ['disp_lines','color','line_color','alpha']
VisParValues := ['true','white','green',0.5]
Status := 'Execution time (default settings): ' + TimeDefault$'.2' + 's'
set_system ('flush_graphic', 'false')
dev_clear_window ()
set_system ('flush_graphic', 'true')
if (OpenGLSupported)KeyPoses := []KeyPoses := [KeyPoses,-29.0731,38.9057,261.771,180.149,29.2463,0.42091,0]KeyPoses := [KeyPoses,-29.0731,38.9057,261.771,180.149,29.2463,0.42091,0]KeyPoses := [KeyPoses,22.1251,63.0441,427.428,73.4444,86.7452,174.49,0]KeyPoses := [KeyPoses,22.1251,63.0441,427.428,73.4444,86.7452,174.49,0]KeyPoses := [KeyPoses,58.9778,21.3299,299.749,47.4176,17.0851,206.948,0]KeyPoses := [KeyPoses,58.9778,21.3299,299.749,47.4176,17.0851,206.948,0]Durations := [3.0,0.5,1.5,0.5,2.0,0.5]animate_object_model_3d (WindowHandle, Surface3DDefault, Pose, [Pose,KeyPoses,Pose0], [0.5,Durations,3.0], VisParNames, VisParValues, 'Resulting triangulation', Pose)
endif
delayed_clear_titled_window (WindowHandle, [], 12, 12, OpenGLSupported)
visualize_object_model_3d (WindowHandle, Surface3DDefault, [], Pose, VisParNames, VisParValues, [DescriptionText,Status], [], Instructions, Pose)
*
*
* Triangulation with mesh morphology
*
* Following parameters enable the mesh morphology, to
* remove artifacts on the surface boundaries.
ParameterNames := ['greedy_mesh_erosion','greedy_mesh_dilation']
ParameterValues := MeshMorpologyParams[0:1]
*
* Display status
DescriptionText := 'Mesh morphology is used to remove artifacts on the boundary'
Status := 'Performing triangulation with mesh morphology ...'
disp_message (WindowHandle, [DescriptionText,Status], 'window', 12, 12, 'black', 'true')
*
* Perform triangulation
count_seconds (Start)
triangulate_object_model_3d (RawPointData3D, 'greedy', [ParameterNames,'information'], [ParameterValues,'verbose'], Surface3DMorphology, Info)
count_seconds (End)
TimeMorphology := End - Start
force_pause (TimeMorphology, ForcePause)
*
* Display results
* object 的颜色  1 2 ,透明程度  背景
VisParNames := ['color_0','color_1','alpha','disp_background']
if (OpenGLSupported)Objects3D := [Surface3DMorphology,Surface3DDefault]VisParValues := ['green','red',0.5,'true']
elseObjects3D := [Surface3DDefault,Surface3DMorphology]VisParValues := ['red','green',0.5,'true']
endif
Status := 'Execution time (with mesh morphology): ' + TimeMorphology$'.2' + 's'
Message := ['After mesh morphology (' + VisParValues[0] + ')','Default settings (' + VisParValues[1] + ')']
delayed_clear_titled_window (WindowHandle, Message, 65, 12, OpenGLSupported)
visualize_object_model_3d (WindowHandle, Objects3D, [], Pose, VisParNames, VisParValues, [DescriptionText,Status], [], Instructions, Pose)
*
*
* Triangulation with mesh morphology and surface removal
*
* Following parameters enable the mesh morphology, to
* remove artifacts on the surface boundaries.
ParameterNames := ['greedy_mesh_erosion','greedy_mesh_dilation','greedy_remove_small_surfaces']
ParameterValues := MeshMorpologyParams
*
*
* Display status
DescriptionText := 'Additionaly you can remove undesired surface pieces.         '
Status := 'Performing triangulation with mesh morphology ...'
dev_clear_window ()
disp_object_model_3d_safe (WindowHandle, Objects3D, [], Pose, VisParNames, VisParValues)
disp_message (WindowHandle, [DescriptionText,Status], 'window', 12, 12, 'black', 'true')
*
* Perform triangulation
count_seconds (Start)
triangulate_object_model_3d (RawPointData3D, 'greedy', [ParameterNames,'information'], [ParameterValues,'verbose'], Surface3DErasure, Info)
count_seconds (End)
TimeSurfaceErasure := End - Start
force_pause (TimeSurfaceErasure, ForcePause)
*
* Display results
VisParNames := ['color_0','color_1','alpha','disp_background']
if (OpenGLSupported)Objects3D := [Surface3DErasure,Surface3DMorphology]VisParValues := ['green','red',0.5,'true']
elseObjects3D := [Surface3DMorphology,Surface3DErasure]VisParValues := ['red','green',0.5,'true']
endif
*
Status := 'Execution time (with mesh erasure): ' + TimeSurfaceErasure$'.2' + 's'
Message := ['After surface erasure (' + VisParValues[0] + ')','After mesh morphology (' + VisParValues[1] + ')']
delayed_clear_titled_window (WindowHandle, Message, 65, 12, OpenGLSupported)
visualize_object_model_3d (WindowHandle, Objects3D, [], Pose, VisParNames, VisParValues, [DescriptionText,Status], [], Instructions, Pose)
*
*
* Triangulate with reduced number of neighbors (k-NN = 10)
*
ParameterNames := [ParameterNames,'greedy_kNN']
ParameterValues := [ParameterValues,10]
*
* Display status
DescriptionText := 'The number of neighbors has a direct impact over the'
DescriptionText[1] := 'triangulation speed. Reduce k-NN to 10 (default = 40)'
DescriptionText[2] := 'and compare execution times.'
Status := 'Performing triangulation with reduced number of neighbors ...'
dev_clear_window ()
disp_object_model_3d_safe (WindowHandle, Objects3D, [], Pose, VisParNames, VisParValues)
disp_message (WindowHandle, [DescriptionText,Status], 'window', 12, 12, 'black', 'true')
*
* Perform triangulation
count_seconds (Start)
triangulate_object_model_3d (RawPointData3D, 'greedy', [ParameterNames,'information'], [ParameterValues,'verbose'], Surface3DkNN10, Info)
count_seconds (End)
TimeKNN10 := End - Start
force_pause (TimeKNN10, ForcePause)
*
* Display results
VisParNames := 'color'
VisParValues := 'green'
Objects3D := Surface3DkNN10
Status := 'Execution time k-NN = 10: ' + TimeKNN10$'.2' + 's (compared to ' + TimeDefault$'.2' + 's (default settings))'
delayed_clear_titled_window (WindowHandle, [], 12, 12, OpenGLSupported)
visualize_object_model_3d (WindowHandle, Objects3D, [], Pose, VisParNames, VisParValues, [DescriptionText,Status], [], Instructions, Pose)
if (OpenGLSupported)* The sub-sampled 3d object used with OpenGL is big* enough to demonstrate what happens with too few* neighbors selected (KNN=5).* * * Triangulation with insufficient number of neighbors* ParameterValues[find(ParameterNames,'greedy_kNN')] := 5* * Display statusDescriptionText := 'The number of neighbors must not be too small. An insufficient     'DescriptionText[1] := 'number of neighbors leads to inconsistent triangulation and'DescriptionText[2] := 'eventually increases the time of the triangulation as well.'Status := 'Performing triangulation with too few neighbors ...'dev_clear_window ()disp_object_model_3d_safe (WindowHandle, Objects3D, [], Pose, VisParNames, VisParValues)disp_message (WindowHandle, [DescriptionText,Status], 'window', 12, 12, 'black', 'true')* * Perform triangulationcount_seconds (Start)triangulate_object_model_3d (RawPointData3D, 'greedy', [ParameterNames,'information'], [ParameterValues,'verbose'], Surface3DkNN5, Info)count_seconds (End)TimeKNN5 := End - Startforce_pause (TimeKNN5, ForcePause)* * Display resultsObjects3D := Surface3DkNN5VisParNames := 'color_0'VisParValues := 'red'Status := 'Execution time k-NN = 5: ' + TimeKNN5$'.2' + 's (compared to ' + TimeKNN10$'.2' + 's with k-NN = 10)'delayed_clear_titled_window (WindowHandle, [], 12, 12, OpenGLSupported)visualize_object_model_3d (WindowHandle, Objects3D, [], Pose, VisParNames, VisParValues, [DescriptionText,Status], [], Instructions, Pose)
endif
*
*
* Cleanup memory
*
dev_clear_window ()
disp_object_model_3d_safe (WindowHandle, Objects3D, [], Pose, VisParNames, VisParValues)
disp_message (WindowHandle, 'End of program', 'window', 12, 12, 'black', 'true')

implicit算法:

implicit_octree_depth 八叉树的深度(一般是在7 左右)

* This example program demonstrates how to use the operator
* triangulate_object_model_3d
*
*
* Init visualization
dev_close_window ()
dev_update_off ()
dev_open_window (0, 0, 800, 600, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
Instructions[0] := 'Rotate: Left button'
Instructions[1] := 'Zoom:   Shift + left button'
Instructions[2] := 'Move:   Ctrl  + left button'
*
* Overview of all default triangulation parameters (implicit mode):
* 'implicit_octree_depth' --> 6
* 'implicit_solver_depth' --> 6
* 'implicit_min_num_samples' --> 1
*
read_object_model_3d ('mvtec_bunny_normals.om3', 'm', [], [], ObjectModel3D, Status)
*
* This model is already triangulated.
* We copy only its points and normals for demonstration purposes.
copy_object_model_3d (ObjectModel3D, ['point_coord','point_normal'], RawPointData3D)
*
* Inspect the point cloud data
create_pose (-43, 47, 920, 218, 37, 352, 'Rp+T', 'gba', 'point', Pose)
visualize_object_model_3d (WindowHandle, RawPointData3D, [], Pose, 'point_size', 1, 'Raw point data to be triangulated', [], Instructions, Pose)
*
*
* Triangulation with default settings
*
* (Only 'information' is set to 'verbose',
* to give additional informations about the
* triangulation process.)
*
* Display status
DescriptionText := 'Triangulation in \'implicit\' mode with default settings'
ParameterNames := 'information'
ParameterValues := 'verbose'
Status := 'This may take a minute. Please wait ...'
disp_message (WindowHandle, [DescriptionText,' ',Status], 'window', 12, 12, 'black', 'true')
*
* Perform triangulation
count_seconds (Start)
triangulate_object_model_3d (RawPointData3D, 'implicit', ParameterNames, ParameterValues, Surface3DDefault, Info)
count_seconds (End)
TimeDefault := End - Start
* If 'information' is set to 'verbose', a lot of useful
* information is returned by triangulate_object_model_3d
* dev_inspect_ctrl (Info)
*
* Display results
VisParNames := ['disp_lines','color','line_color','alpha']
VisParValues := ['true','white','green',0.5]
Status := 'Execution time: ' + TimeDefault$'.2' + 's'
visualize_object_model_3d (WindowHandle, Surface3DDefault, [], Pose, VisParNames, VisParValues, [DescriptionText,Status], [], Instructions, PoseOut)
*
*
* Triangulation with a deeper octree
*
ParameterNames := 'implicit_octree_depth'
ParameterValues := 7
*
* Display status
DescriptionText := 'A triangulation with a higher level of detail can be achieved'
DescriptionText[1] := 'by increasing the octree depth. This results in a longer'
DescriptionText[2] := 'execution time of the operator.'
Status := 'Performing triangulation with a deeper octree ...'
disp_message (WindowHandle, [DescriptionText,' ',Status], 'window', 12, 12, 'black', 'true')
*
* Perform triangulation
count_seconds (Start)
triangulate_object_model_3d (RawPointData3D, 'implicit', [ParameterNames,'information'], [ParameterValues,'verbose'], Surface3DDepth7, Info)
count_seconds (End)
TimeDepth7 := End - Start
*
* Display results
Status := 'Execution time (octree depth = 7): ' + TimeDepth7$'.2' + 's'
visualize_object_model_3d (WindowHandle, Surface3DDepth7, [], Pose, VisParNames, VisParValues, [DescriptionText,Status], [], Instructions, PoseOut)

Halcon 案例2:

halcon 案例3

* This program shows how to use simplify_object_model_3d
* to simplify a complex 3d object model to different degrees.
*
dev_close_window () //关闭窗口
dev_open_window (0, 0, 512, 512, 'black', WindowHandle) //打开窗口
set_display_font (WindowHandle, 14, 'mono', 'true', 'false') //设置字体
* Specify a camera for visualization purposes
gen_cam_par_area_scan_division (0.08, 0, 6e-6, 6e-6, 256, 256, 512, 512, CamParam) //得到相机扫描的参数
create_pose (-40, 45, 2100, 195, 45, 5, 'Rp+T', 'gba', 'point', CamPose) //创建位姿
*以下三行是显示的提示数据
Instructions[0] := 'Rotate: Left button'
Instructions[1] := 'Zoom:   Shift + left button'
Instructions[2] := 'Move:   Ctrl  + left button'
*
* Read the triangulated 3d object model (note that the
* model must be triangulated to be able to pass it to
* simplify_object_model_3d).
read_object_model_3d ('mvtec_bunny.om3', 'm', [], [], ObjectModel3D, Status) //读取om3格式的点云数据
*
* Visualize the original 3d object model
* 以下这两句是显示点云数据
get_object_model_3d_params (ObjectModel3D, 'num_points', NumPointsOrig)
visualize_object_model_3d (WindowHandle, ObjectModel3D, CamParam, CamPose, ['color','disp_background'], ['green','true'], ['Original model','with ' + NumPointsOrig + ' points'], [], Instructions, CamPose)
*
* Simplify the 3d object model to different degrees
dev_open_window (0, 516, 512, 512, 'black', WindowHandleSimplified) //另开一个窗口
set_display_font (WindowHandleSimplified, 14, 'mono', 'true', 'false') //设置这个窗口的字体
PercentageRemaining := [10,1,0.1] //设置简化的倍数 10、1、0.1
for Index := 0 to |PercentageRemaining| - 1 by 1 //开启循环Amount := PercentageRemaining[Index]simplify_object_model_3d (ObjectModel3D,  'preserve_point_coordinates', Amount, 'amount_type', 'percentage_remaining', SimplifiedObjectModel3D) //简化点云数据dev_clear_window ()*以下这两句是显示已经被简化的点云数据get_object_model_3d_params (SimplifiedObjectModel3D, 'num_points', NumPoints)visualize_object_model_3d (WindowHandleSimplified, SimplifiedObjectModel3D, CamParam, CamPose, 'color', 'green', ['Simplified model','with ' + NumPoints + ' points (' + Amount + '% of original points)'], [], Instructions, CamPose)
endfor //结束循环

Halcon 3D 三维重建相关推荐

  1. Halcon 3D 常见算子描述

    一.简介 halcon 中有很多常见的算子,我们经常在用,但是作为一名算法工程师我们不仅要会用,知道原理也是很重要的,所以对于很多事情我们不仅要所以然更有知其所以然. 二.算子解释 1.smooth_ ...

  2. Halcon 3D 切片法检测物料

    一.简介 在上一篇中,学习了鞋底切片法来求轮廓,那个思路是比较简单的,其次还提到了法向量重建的方法,目前由于没有用法向量重建来做那个项目,所以还是有很大的疑问,后续会继续学习那个方法然后重新在做一次, ...

  3. Halcon—3D测量算法的那点数学公式和代码实现

    Halcon-3D测量算法的那点数学公式和代码实现 ✨博主介绍 前言 Halcon源码 ✨博主介绍

  4. HALCON双目三维重建实验

    下面是标定双目并进行双目标定的halcon代码,我使用的图片分辨率太高了,所以笔记本无法运行,使用台式机测试成功,但是图片需要拍得比较好才行.这里进行了三维重建,实验只需要生成视差图,可以去掉一部分代 ...

  5. Halcon 3D点云和深度图的相互转化

    3D点云和深度图 1. 如何将灰度图转为3D点云 2. 创建一张深度图 3. 深度图转点云.点云转深度图 4. 代码和图片下载地址 1. 如何将灰度图转为3D点云 这里所说的灰度图转为3D点云,其实是 ...

  6. 08 Halcon 3D点云体积计算

    1.基于halcon算法平台:2.提供深度图源文件以及解压密码:3.代码预览: /*********************************************************** ...

  7. 01 Halcon 3D深度图转彩色

    1.基于halcon算法平台:2.提供深度图源文件以及解压密码:3.代码预览: /*************************** @文档名称: 深度图转彩色图像. @作者: hugo @版本: ...

  8. halcon 3D Object Model 三维物体模型算子,持续更新

    目录 3D Object Model 三维物体模型 Creation创建 1.clear_object_model_3d 2.copy_object_model_3d 3. deserialize_o ...

  9. Halcon 3D moments_object_model_3d简介

    一.矩简介 Opencv 笔记11 图像的矩原理解析_Σίσυφος1900的博客-CSDN博客_opencv 图像的矩 矩是概率与统计中的一个概念,假设有随机变量X,常数c,正整数k,则有 E[(X ...

最新文章

  1. Navicat for Oracle工具连接oracle
  2. SpringMvc CharacterEncodingFilter 解析 encoding 参数并初始化参数
  3. C/C++使用socket实现server和client
  4. Java之IO操作总结
  5. Hive常见的属性配置
  6. 商标申请的企业法律服务可避免法律风险
  7. Android Lint 实践 —— 简介及常见问题分析
  8. 解读年度数据库性能:PostgreSQL的日志文件和数据加载
  9. IT职场人生系列之二十:危险职业(续1)
  10. delphi 中文转 ascii编码_【转】Python 中文编码
  11. java web 密码加密_JavaWeb日记——Shiro之密码加密
  12. Laravel框架介绍与简介
  13. 浅谈IPv4/IPv6转换技术
  14. juniper认证(JNCIA,JNCIS,JNCIP,JNCIE)介绍
  15. 中国20顶级富豪惊人挥霍排行榜 仅一家IT老板
  16. 活动现场大屏幕互动系统(微信墙)修复版完美PHP源码,带完整素材包和详细使用文档
  17. arm服务器计算性能,【干货分享】ARM/x86服务器的ceph性能对比报告
  18. vb.net操作数据库之ACCESS(1)
  19. 破解版的cornerstore(mac版)
  20. 虚拟机 Ubuntu16.04开机蓝屏问题

热门文章

  1. 推荐几个Python学习神器
  2. 第6篇 | Weblogic反序列化攻击不依赖日志溯源攻击时间
  3. ROS:服务数据(srv)的定义与使用
  4. 为什么越来越多人选择3D打印模型手办
  5. Microsoft Teams出现无法连接服务器等等的异常,重装也无法修复的处理方法
  6. 【风控体系】互联网反欺诈体系建设
  7. SpeedFan 4.20
  8. 魔域单机版mysql_魔域单机版
  9. python requests下载网页_python爬虫 requests-html的使用
  10. 益丰大药房Java开发,益丰大药房面试经验