PointCloudLibrary / PointCloudLibrary/pcl

[filters] CropHull unexpected number of intersections

Open
#3,912 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: bug module: filters needs: testing
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Context
I am using CropHull to test if a single point is inside the hull of a sphere. In applyFilter3D(PointCloud &output) function of crop_hull.hpp, I get unexpectedly high number of intersections for the given point.

Here is what I added to the function (using this fix) :

    bool isPointInsideHull = (crossings[0]&1) + (crossings[1]&1) + (crossings[2]&1) > 1;
    if ((crop_outside_ && isPointInsideHull) || (!crop_outside_ && !isPointInsideHull)) {
      cout << "crossing ray 0 : " << crossings[0] << endl;
      cout << "crossing ray 1 : " << crossings[1] << endl;
      cout << "crossing ray 2 : " << crossings[2] << endl;

      cout << "point is inside hull !-------------------------------------------------------------- " << endl;
      this_thread::sleep_for(10000ms);
      output.push_back (input_->points[(*indices_)[index]]);
    }

Current Behavior
This is the resulting number of intersections I got for each ray :

crossing ray 0 : 1405                                                                                                   
crossing ray 1 : 1407                                                                                                   
crossing ray 2 : 1397 

Expected behavior
I expected crossings array to contain either 0 (no intersection, possibility that the point is outside), 1 (1 intersection, possibility that the point is inside) or 2 values (2 intersections, possibility that the point is outside of the sphere).

To Reproduce
I use PCL 1.8.0 on Windows 10. Here is the link to the files used :

  • polygon.ply contains the hull information
  • unit_test.ply is the input point cloud we want to test

@taketwo @kunaltyagi

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crop_hull.hpp, specifically applyFilter3D(PointCloud &output), and reproduce the PCL 1.8.0 Windows 10 case with polygon.ply and unit_test.ply. Compare the crossings calculation with the expected 0–2 intersections and inspect the referenced fix for context. Done when the cause of the roughly 1,400 intersections is identified and the reported point-in-hull behavior matches expectations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.