开启左侧

[HALCON文档] Halcon读取.ply格式文件并且显示3D模型

[复制链接]
Princess 发表于 2019-6-13 11:34:56 | 显示全部楼层 |阅读模式
利用算子read_object_model_3d来实现,支持以下格式:
  1. 'om3':
  2. HALCON format for 3D object model. Files with this format can be written by write_object_model_3d. The default file extension for this format is 'om3'.

  3. 'dxf':
  4. AUTOCAD format. See below for details about reading this file format. The default file extension for this format is 'dxf'.

  5. 'off':
  6. Object File Format. This is a simple ASCII-based format that can hold 3D points and polygons. The binary OFF format is not supported. The default file extension for this format is 'off'.

  7. 'ply':
  8. Polygon File Format (also Stanford Triangle Format). This is a simple format that can hold 3D points, point normals, and polygons. HALCON supports both the ASCII and the binary version of the format. The default file extension for this format is 'ply'.

  9. 'obj':
  10. OBJ file format, also 'Wavefront OBJ-Format'. This is an ASCII-based format that can hold 3D points, polygons, normals, texture coordinates, materials and other information. HALCON supports points ('v'-lines) and polygonal faces ('f'-lines). Other entities are ignored. The default file extension for this format is 'obj'.

  11. 'stl',
  12. 'stl_binary',
  13. 'stl_ascii':
  14. STL file format, also 'Stereolithography format', 'SurfaceTesselationLanguage ', 'StandardTriangulationLanguage', and 'StandardTesselationLanguage'. This format stores triangles and triangle normals. However, as triangle normals are not supported by HALCON 3D object models, only triangles are read while the triangle normals are ignored. Normals are recomputed from the triangles if required. HALCON reads both the ASCII and the binary version of this format. If 'stl' is set, HALCON will autodetect the type. Setting the type to 'stl_binary' or 'stl_ascii' will enforce the corresponding format. The default file extension for this format is 'stl'.
复制代码

Scale参数定义如下:
  1. Unit         Scaling factor
  2. m         1
  3. dm         0.1
  4. cm         0.01
  5. mm         0.001
  6. µm, microns         1e-6
  7. nm         1e-9
  8. km         1000
  9. in         0.0254
  10. ft         0.3048
  11. yd         0.9144
复制代码

具体代码如下:
  1. dev_close_window ()
  2. dev_open_window (0, 0, 400, 500, 'black', WindowHandle)
  3. *读取单帧点云ply文件
  4. read_object_model_3d('D:/3DMVS/Data/Image_20190613112209544.ply', 'mm', 'convert_to_triangles', 'true', ObjectModel3D, Status)

  5. Instructions[0] := 'Rotate: Left button'
  6. Instructions[1] := 'Zoom:   Shift + left button'
  7. Instructions[2] := 'Move:   Ctrl  + left button'

  8. Message := 'Hik3D PointCloud'
  9. *可视化模型并且显示
  10. visualize_object_model_3d (WindowHandle, ObjectModel3D, [], [], [], [], Message, [], Instructions, PoseOut)
  11. dev_clear_window ()
复制代码

效果图象:
QQ截图20190613113439.png

ply文件下载:
Image_20190613112209544.rar (4.35 KB, 下载次数: 74)
陌上花开 发表于 2021-1-20 16:11:22 | 显示全部楼层
感谢楼主分享,希望有用
bczy 发表于 2021-1-23 22:41:47 | 显示全部楼层
大神威武
toyd408 发表于 2021-4-9 22:23:04 | 显示全部楼层
多谢分享,学习中
yardley 发表于 2021-6-3 19:13:09 | 显示全部楼层
一片白怎么搞?
 楼主| Princess 发表于 2021-6-16 15:52:22 | 显示全部楼层
yardley 发表于 2021-6-3 19:13
一片白怎么搞?

默认是没有进行点云着色或点云纹理化的,要自己设置!
参考:https://www.51halcon.com/forum.p ... 69&fromuid=1045

fullyiop 发表于 2021-10-6 10:57:05 | 显示全部楼层
学习,学习
panrs 发表于 2022-6-6 17:15:23 | 显示全部楼层
学习下这个read_object_model_3d算子
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表