PCL.jl is a Julia interface to the Point Cloud Library (PCL): https://github.com/r9y9/PCL.jl.
ENV["PCLJL_VERBOSE"] = 0
using PCL
using Cxx
pcd_file = Pkg.dir("PCL", "test", "data", "table_scene_lms400.pcd")
# pcd_file = Pkg.dir("PCL", "test", "data", "milk_cartoon_all_small_clorox.pcd")
cloud = pcl.PointCloud{pcl.PointXYZ}(pcd_file);
cloud_filtered = pcl.PointCloud{pcl.PointXYZ}()
sor = pcl.StatisticalOutlierRemoval{pcl.PointXYZ}()
pcl.setInputCloud(sor, cloud)
pcl.setMeanK(sor, 50)
pcl.setStddevMulThresh(sor, 1.0)
pcl.filter(sor, cloud_filtered)
println("PointCloud before filtering: $(length(cloud)) data points")
println("PointCloud before filtering: $(length(cloud_filtered)) data points")
PointCloud before filtering: 460400 data points
viewer = pcl.PCLVisualizer("pcl visualizeer", create_interactor=false)
pcl.addCoordinateSystem(viewer, 0.2)
pcl.setCameraPosition(viewer, 0,0,1, 0,0,0)
pcl.setOffScreenRendering(viewer, true)
# Add point clouds
red_handler = pcl.PointCloudColorHandlerCustom(cloud, 255, 0, 0)
green_handler = pcl.PointCloudColorHandlerCustom(cloud, 0, 255, 0)
pcl.addPointCloud(viewer, cloud, red_handler, id="cloud")
pcl.addPointCloud(viewer, cloud_filtered, green_handler, id="cloud_filtered")
true
PointCloud before filtering: 451410 data points
data = pcl.renderedData(viewer)
display("text/html", "<img src=data:image/png;base64,$(base64encode(data))>")
# Zoom againt Z-axis
pcl.setCameraPosition(viewer, 0,0,0.5, 0,0,0)
data = pcl.renderedData(viewer)
display("text/html", "<img src=data:image/png;base64,$(base64encode(data))>")