How to crop pts. file with Open3D
I have tried to use the same method of cropping .ply, to crop the pts file. However, the crop is not successful, zero points have been cropped and display. Here are my whole code and json file:
Whole code: import open3d as o3d import numpy as np
print("Load a ply point cloud, print it, and render it") pcd = o3d.io.read_point_cloud("C://20201224(1).pts") print(pcd) print(np.asarray(pcd.points))
print("Load a polygon volume and use it to crop the original point cloud") vol = o3d.visualization.read_selection_polygon_volume( "C://data_file.json") chair = vol.crop_point_cloud(pcd) o3d.visualization.draw_geometries([chair]) print(chair) print("")
json file: {
"bounding_polygon" :
[
[843226.7500, 831036.5625, 0.0],
[843226.0625, 831036.5625, 0.0],
[843226.6875, 831037.0625, 0.0],
[843226.7500, 831036.5625, 0.0],
[843226.7500, 831036.5625, 0.0]
],
"class_name" : "SelectionPolygonVolume",
"orthogonal_axis" : "Y",
"version_major" : 1,
"version_minor" : 0
}
Displayed result: Load a ply point cloud, print it, and render it PointCloud with 26602257 points. [[8.31091980e+05 8.43226325e+05 1.42900000e+01] [8.31083305e+05 8.43230736e+05 1.40440000e+01] [8.31083378e+05 8.43230671e+05 1.42830000e+01] ... [8.30988062e+05 8.43247303e+05 3.04510000e+01] [8.30987985e+05 8.43247261e+05 3.04490000e+01] [8.30987915e+05 8.43247237e+05 3.04040000e+01]] Load a polygon volume and use it to crop the original point cloud PointCloud with 0 points.
can anyone tell me what is the problem? Thank you so much.
Were you able to fix it already? If not, feel free to reopen this issue.