Note that there are some explanatory texts on larger screens.

plurals
  1. POConvex Hull calculation in Point Cloud Library fails in 2 as well as 3 dimensions
    primarykey
    data
    text
    <p>i'm following the tutorial of the PCL docs for calculating a 2D Convex Hull <a href="http://www.pointclouds.org/documentation/tutorials/convex_hull2d.php" rel="nofollow">see here</a>.</p> <p>I have a cloud and some indices, project them on a plane with given coefficients and then calculate the convex hull. Here's the code:</p> <pre><code>PointCloud&lt;PointXYZ&gt;::Ptr tmpInliers(new PointCloud&lt;PointXYZ&gt;()); ProjectInliers&lt;PointXYZ&gt; proj; proj.setModelType(SACMODEL_PLANE); proj.setInputCloud(someCloud); proj.setIndices(someIndices); proj.setModelCoefficients(someCoefficients); proj.filter(*tmpInliers); PointCloud&lt;PointXYZ&gt;::Ptr hull(new PointCloud&lt;PointXYZ&gt;()); ConvexHull&lt;PointXYZ&gt; chull; chull.setInputCloud(tmpInliers); chull.setComputeAreaVolume(true); chull.setDimension(3); &lt;--- see below chull.reconstruct(*hull); </code></pre> <p>The results i get for the total area and volume are around: </p> <pre><code> Area &amp; Volume of convex hull: 7.8726e-312 2.122e-314 </code></pre> <p>For values of <strong>tmpInliers</strong> ranging around</p> <pre><code>(-0.80562,-0.787018,2.25184) (-0.477351,-0.798953,2.11432) (-0.633823,-0.750283,2.96717) [....] </code></pre> <p>If i change "setDimensions" to "2" i get the following error</p> <pre><code>[pcl::ConvexHull::performReconstrution2D] ERROR: qhull was unable to compute a convex hull for the given point cloud (size of cloud)! </code></pre> <p>In the following example i am constructing a example and fail in every case (setDimension set to 2 or 3) with one of the failures from before (either "qhull was unable..." or a strange result according to values from the ConvexHull.</p> <pre><code>PointCloud&lt;PointXYZ&gt;::Ptr hugeBox(new PointCloud&lt;PointXYZ&gt;()); hugeBox-&gt;push_back(PointXYZ(10, 10, 10)); hugeBox-&gt;push_back(PointXYZ(10, 10, -10)); hugeBox-&gt;push_back(PointXYZ(10, -10, 10)); hugeBox-&gt;push_back(PointXYZ(10, -10, -10)); hugeBox-&gt;push_back(PointXYZ(-10, 10, 10)); hugeBox-&gt;push_back(PointXYZ(-10, 10, -10)); hugeBox-&gt;push_back(PointXYZ(-10, -10, 10)); hugeBox-&gt;push_back(PointXYZ(-10, -10, -10)); // Project inliers onto plane model PointCloud&lt;PointXYZ&gt;::Ptr hugePlane(new PointCloud&lt;PointXYZ&gt;()); ProjectInliers&lt;PointXYZ&gt; proj; proj.setModelType(SACMODEL_PLANE); proj.setInputCloud(hugeBox); proj.setModelCoefficients(coefficients); proj.filter(*hugePlane); // get the convex hull of plane vector&lt;Vertices&gt; polygonsOut; PointCloud&lt;PointXYZ&gt;::Ptr hugeHull(new PointCloud&lt;PointXYZ&gt;()); ConvexHull&lt;PointXYZ&gt; chull; chull.setInputCloud(hugePlane); chull.setDimension(2); chull.reconstruct(*hugeHull, polygonsOut); </code></pre> <p>I'm a little stuck here. Why does it fail if i set it to 2 dimensions? And if i set it to 3 dimensions i occasionaly the following warning:</p> <pre><code>qhull precision warning: The initial hull is narrow (cosine of min. angle is 0.9999999999999991). A coplanar point may lead to a wide facet. </code></pre> <p>I understand that this is the case if i have a planar projection, but how to avoid this? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload