zivid / zivid-halcon-samples

HALCON code samples for Zivid
https://zivid.com
BSD 3-Clause "New" or "Revised" License
13 stars 6 forks source link

Center of Zivid Camera Appearing in the point cloud #47

Closed HM102 closed 1 year ago

HM102 commented 2 years ago

When I acquire a point cloud using Halcon, I am always getting an extra point which resembles the zivid camera center.

You can see the point in the top right corner of the below image.

How can I remove this point?

image

SatjaSivcev commented 2 years ago

Halcon does not support nan values for point clouds. To keep the point cloud ordered/structured, actually to keep all the points from the Zivid camera, we had to convert our nans (invalid points, filtered out points, etc.) to zeros.

To the best of our knowledge, this is the only method that Halcon supports if the point cloud is to remain ordered, actually complete (with all points, valid and invalid).

If the point cloud is to be made unordered, the 'zero' points would be gone. This is then basically a process of removing the zero points. See the implementation in c++ here: https://github.com/zivid/zivid-halcon-samples/blob/380686d60566375b1fce57a11a18d03c1fa1cfdf/source/cpp/Camera/Basic/CaptureViaGenICam/CaptureViaGenICam.cpp#L104-L108 The same should be possible to implement in hdev.

Halcon has a method to preserve the order (using an attribute called xyz_mapping). See here: https://github.com/zivid/zivid-halcon-samples/blob/380686d60566375b1fce57a11a18d03c1fa1cfdf/source/cpp/Camera/Basic/CaptureViaZivid/CaptureViaZivid.cpp#L34-L35 Once you create xyz_mapping, you can assign it to ObjectModel3D as an attribute, thus making it 'ordered' again but without zeros