Closed christinaionescu closed 2 years ago
Hi @christinaionescu, thanks for taking an interest in our code! This code is intended for use with our Zivid 3D cameras which produce an organized point cloud, including color. We usually want to maintain the organization to simplify lookup between the 2D image and 3D-coordinates. The reason we use nan_to_num
is that some external tools, such as Open3D visualization, don't support nan-values.
Zero is a useful value as it's impossible to get a point inside the camera (in the camera origin). For visualization I agree that it's a bit silly to keep these values, and indeed we remove the organization when we reshape to a list of coordinates.
Hi,
yes I completely understand why you do it this way if the organization is relevant. In my case I want to perform pointcloud registration so I reshape it anyways to transform the data to a pointcloud. Here, it can influence the pointcloud registration algorithm if I have many points set to zero instead of just deleting them. This is why it was relevant to me :)
Thank you for your answer and best regards
That makes perfect sense! Thanks :)
Hi everyone,
when extracting the pointcloud I often see formulations where the np.nan_to_num function is applied to the xyz values. For example here https://github.com/zivid/zivid-python-samples/blob/master/source/sample_utils/display.py#L54-L93 in line 59.
xyz = np.nan_to_num(xyz).reshape(-1, 3)
Why is this approach chosen? Would it not make sense to simply delete those nan values?
In my code I went for this version:
Is there a reason for your approach to keep them as zero values or do you have a better idea than mine?
Thank you!