0
votes

Is it possible to retrieve index point from PCL pointcloud file?

I have pointcloud data in txt file with XYZ and some other colum information. I use the following code to convert the txt file into pcl cloud file:

import pandas as pd
import numpy as np
import pcl

data = pd.read_csv('data.txt', usecols=[0,1,2], delimiter=' ')

pcl_cloud = pcl.PointCLoud()

cloud = pcl_cloud.from_array(np.array(data, dtype = np.float32))

As I know, the module from_array only need the XYZ column. After some processing (eg. filtering), the number of raw and result most probably different. Is it possible to know which point number from the result file, so I can mix it with another information from the raw data?

I tried to filter by comparing the coordinates, but it doesn't work because the coordinate slightly changes during the converting from double to float.

Any idea? Thank you very much

1
what about rounding both values before comparing? - marcos
I also tried it, but because the differences between coordinates are very small, rounding will resulting in more than one number - vanbuuren
I just got the answer. Thanks for the suggestion @Marcos - vanbuuren

1 Answers

0
votes

I just got the answer, by using extract indices.

eg:

filter = pcl.RadiusOutlierRemoval(data)
indeces = filter.Extract()

Thanks