Skip to content

Save PLY point clouds in all capture samples #8

Description

@SatjaSivcev

For C++, C#, Python, all capture samples save to ZDF, which is not possible for Halcon (HDevelop). Then, we instead should save to PLY by default.

A function (Halcon procedure) to save ply is to be made that can be reused for conversion to simplify the code. Use the code from the CaptureSavePLY. The function should include the following lines:

<c>* Extracting the following images: X, Y, Z, SNR, and RGB</c>
<l>select_obj (Image, X, 1)</l>
<l>select_obj (Image, Y, 2)</l>
<l>select_obj (Image, Z, 3)</l>
<l>select_obj (Image, Confidence, 4)</l>
<l>select_obj (Image, RGB, 5)</l>
<c></c>
<c>* Transforming 3D points from X, Y, Z images to a HALCON 3D object model</c>
<l>xyz_to_object_model_3d (X, Y, Z, ObjectModel3D)</l>
<c></c>
<c>* Adding RGB data to the 3D point cloud</c>
<l>decompose3 (RGB, R, G, B)</l>
<c></c>
<l>get_domain (R, Domain)</l>
<l>get_region_points (Domain, Rows, Columns)</l>
<l>get_grayval (R, Rows, Columns, GrayvalR)</l>
<l>set_object_model_3d_attrib_mod (ObjectModel3D, 'red', 'points', GrayvalR)</l>
<c></c>
<l>get_domain (G, Domain)</l>
<l>get_region_points (Domain, Rows, Columns)</l>
<l>get_grayval (G, Rows, Columns, GrayvalG)</l>
<l>set_object_model_3d_attrib_mod (ObjectModel3D, 'green', 'points', GrayvalG)</l>
<c></c>
<l>get_domain (B, Domain)</l>
<l>get_region_points (Domain, Rows, Columns)</l>
<l>get_grayval (B, Rows, Columns, GrayvalB)</l>
<l>set_object_model_3d_attrib_mod (ObjectModel3D, 'blue', 'points', GrayvalB)</l>
<c></c>
<c>* Displaying 3D color point cloud, press the button to continue</c>
<l>dev_set_window (Window3D)</l>
<l>Instructions[0] := 'Rotate: Left button'</l>
<l>Instructions[1] := 'Zoom: Shift + left button'</l>
<l>Instructions[2] := 'Move: Ctrl + left button'</l>
<l>visualize_object_model_3d (Window3D, ObjectModel3D, [], [], ['red_channel_attrib','green_channel_attrib','blue_channel_attrib'], ['red','green','blue'], '', [], '', PoseOut)</l>
<c></c>
<c>* Writing a 3D object model in a PLY file format</c>
<l>write_object_model_3d (ObjectModel3D, 'ply', 'Zivid3DPLY.ply', ['invert_normals'], ['true'])</l>
with one exception: visualization should not be included.

That function is to be included in samples with capture (same ones in cpp that save to zdf), so Capture.hdev, CaptureHDR.hdev, etc.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions