strawlab / python-pcl

Python bindings to the pointcloud library (pcl)
http://strawlab.github.com/python-pcl/
Other
2.01k stars 700 forks source link

example surface reconstruction #260

Open AndreAhmed opened 5 years ago

AndreAhmed commented 5 years ago

Hi, Would you please give an example of surface reconstruction ?

That's what I came up with

from __future__ import print_function

import numpy as np
import pcl
import pcl.pcl_visualization

# from pcl.pcl_registration import icp, gicp, icp_nl
f3data = np.loadtxt(r'C:\ahmed\Waltersdorf_F3.csv', delimiter=',', dtype=[('id', np.str_, 20), ('x1', np.float32), ('x2', np.float32), ('x3', np.float32), ('type', np.str_, 20)])

x1_list = np.array(f3data['x1'], dtype=np.float32)
x2_list = np.array(f3data['x2'], dtype=np.float32)
x3_list = np.array(f3data['x3'], dtype=np.float32)
intensity = np.ones(len(f3data['x3']))

ptcloud = np.vstack((x1_list, x2_list, x3_list, intensity)).transpose()
cloud = pcl.PointCloud_PointXYZI()
cloud.from_array(np.array(ptcloud, dtype=np.float32))

visual = pcl.pcl_visualization.CloudViewing()

# PointXYZ
# visual.ShowMonochromeCloud(cloud)

# visual.ShowGrayCloud(cloud, b'cloud')
visual.ShowGrayCloud(cloud, b'cloud')
# visual.ShowColorACloud(cloud, b'cloud')

# while True:
#     visual.WasStopped()
# end

flag = True
while flag:
    flag != visual.WasStopped()
niranjanreddy891 commented 5 years ago

@AndreAhmed, this library supports for .pcd fles as of now. But I can see that you gave .csv as input which doesn't support for your requirement.