Getting stareted
PCL Julia packages follows the PCL module structure. If you need a particular module (e.g. PCLCommon.jl), then you can use the specific module(s) as follows:
using PCLCommon
If you want to import all the PCL packages, then:
using PCL
Note that it will take a few times to load (30 seconds~) since it compiles all the PCL packages.
PointCloud{PointT}
The most frequently used type would be PointCloud
(defined in PCLCommon.jl), which represents arbitary point type of point cloud (pcl::PointCloud<PointT>::Ptr
in C++). In this section we will show the basic usage of PointCloud type quickly.
Create an empty point cloud
using PCLCommon
cloud_xyz = PointCloud{PointXYZ}()
For different point types, just change the type parameter as follows:
cloud_rgba = PointCloud{PointXYZRGBA}()
Create a point cloud with specified size
cloud_xyz = PointCloud{PointXYZ}(100, 200) # width=100, height=200
IO
Load a PCD file
using PCLCommon
using PCLIO
cloud_xyz = PointCloud{PointXYZ}("your_pcd_data.pcd")
needs PCLIO.jl in addition to PCLCommon.jl.
Filtering
PassThrough filter
using PCLCommon
using PCLIO
using PCLFilters
cloud = PointCloud{PointXYZRGB}("your_pcd_file.pcd")
cloud_filtered = PointCloud{PointXYZRGB}()
pass = PassThrough{PointXYZRGB}()
setInputCloud(pass, cloud)
setFilterFieldName(pass, "z")
setFilterLimits(pass, 0.0, 1.0)
filter(pass, cloud_filtered)
needs PCLFilters.jl.
Visualization
using PCLCommon
using PCLIO
using PCLVisualization
cloud = PointCloud{PointXYZRGB}("your_pcd_file.pcd")
viewer = PCLVisualizer("pcl visualizer")
addPointCloud(viewer, cloud, id="input")
spin(viewer) # you will see the PCLVisualizer
needs PCLVisualization.jl.
Examples and tutorials
See JuliaPCL/PCL/test directory for more examples. It includes more complex filtering, feature extraction, recognition, tracking and visualization examples and also some PCL tutorial translations as well.