Computer Vision News - December 2019
Open3D for 3D processing 43 Open3D was meant to be simple and easy to use. In order to read the file "pointcloud. ply", print the result, and write it down, we simply run the following lines of code: This is fairly simple, and now we are ready to do the cooler stuff. Outliers Removal When collecting data from scanning devices, usually the point cloud contains many outliers and artifacts. Since, in our case, the point cloud was generated by a 2D images, some outlier matches were triangulated to an erroneous 3D point. To cope with these phenomena, Open3D offers several outliers removal algorithms. We next describe each one of them. The first method we use is downsampling. In order to represent the object more accurately in a point cloud, it is sometimes beneficial to downsample the data using some heuristics. We show below two kinds of downsampling; the first is downsample by voxels, meaning that we divide the space into voxels and represent all the points at each voxel by their centroid. The second down sample method we demonstrate is uniform, meaning that we collect every n-th points uniformly. The code and the results can be seen below: import numpy as np import open3d as o3d import copy print ( "Reading and writing file..." ) pcd = o3d . io . read_point_cloud( "pointcloud.ply" ) print (pcd) o3d . io . write_point_cloud( "copy_of_file.pcd" , pcd) print ( "Downsample the point cloud with a voxel of 0.02" ) voxel_down_pcd = pcd . voxel_down_sample(voxel_size = 0.02 ) o3d . visualization . draw_geometries([voxel_down_pcd]) print ( "Every 5th points are selected" ) uni_down_pcd = pcd . uniform_down_sample(every_k_points = 5 ) o3d . visualization . draw_geometries([uni_down_pcd])
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=