Converting LAS file to numpy array?
PointsXYZIC is now a numpy array. Which means you can use numpy indexing to filter the data you're interested in. For example you can use an index of booleans to determine which points to grab.
#the values we're classifying against unclassified = 1 ground = 2 #create an array of booleans filter_array = np.any( [ PointsXYZIC[:, 4] == unclassified, #The final column to index against PointsXYZIC[:, 4] == ground, ], axis=0 ) #use the booleans to index the original array filtered_rows = PointsXYZIC[filter_array]
You should now have a numpy array with all the values where the data is unclassified or ground. To get the values that have been classified you could use:
filter_array = np.all( [ PointsXYZIC[:, 4] != unclassified, #The final column to index against PointsXYZIC[:, 4] != ground, ], axis=0 )
Use laspy to read LAS files and easily return the data as numpy arrays you can interact with. laspy is pure python, is almost as fast as libLAS, has more features than the libLAS Python bindings, and is much easier to deploy.