I am trying to fit a plane to a set of point cloud. I tried using Point Cloud Library (PCL) & it works well. What I need to know is that how can I obtain the coefficients a,b,c of the fitted plane (ax+by+cz+1=0). Is there any straightforward way? I got some insights from here: 3D Least Squares Plane
See the following planar segmentation tutorial:
http://pointclouds.org/documentation/tutorials/planar_segmentation.php
Note in particular the use of the pcl::ModelCoefficients
data structure.
Allocation:
pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
Use:
seg.segment (*inliers, *coefficients);
Meaning:
coefficients->values[0]/coefficients->values[3]
is your a.
coefficients->values[1]/coefficients->values[3]
is your b.
coefficients->values[2]/coefficients->values[3]
is your c.
See also:
http://docs.pointclouds.org/1.7.0/structpcl_1_1_model_coefficients.html