how to convert .stcm file to pointcloud or CSV

162 Views Asked by At

I have a lidar that gives me output as a test.stcm I want to write a script that converts the .stcm to CSV or point cloud form. I used the following script but it doesn't work

import laspy
import pcl
# 
# Open the .stcm file
inFile = laspy.file.File("test.stcm", mode="r")
# 
# Extract the point cloud data from the file
x = inFile.x
y = inFile.y
z = inFile.z
# 
# Create a .las file from the extracted data
outFile = laspy.file.File("output.las", mode="w", header=inFile.header)
outFile.x = x
outFile.y = y
outFile.z = z
outFile.close()
# 
# Open the .las file with PCL
cloud = pcl.io.las.read_las_file("output.las")
# 
# Perform any additional processing on the point cloud using PCL
cloud_filtered = cloud.make_statistical_outlier_filter()
cloud_filtered.set_mean_k(50)
cloud_filtered.set_std_dev_mul_thresh(1.0)
cloud_filtered.filter()

# Save the point cloud to a file
pcl.io.save_point_cloud("output.ply", cloud)

but I get the following error

    inFile = laspy.file.File("test.stcm", mode="r")
  File "C:\Users\mubas\AppData\Local\Programs\Python\Python310\lib\site-packages\laspy\file.py", line 6, in __init__
    raise errors.LaspyException(
laspy.errors.LaspyException: You are using laspy 2.0, which has several improvements over 1.x
            but with several breaking changes.
0

There are 0 best solutions below