PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.94k stars 4.61k forks source link

locating multiple instances of template matches #3050

Closed dan9thsense closed 2 years ago

dan9thsense commented 5 years ago

I am using the template alignment tutorial with great success and find it very valuable (huge thank you to whoever wrote it). I would like to extend the results to return not just the best match, but rather a list of matches found, so that if there are multiple instances of the same template in the pointcloud, I can find them.

RIght now, I detect a match and then remove the matched area from the original point cloud, then iterate. It works, but it is clunky.

Suggestions?

stale[bot] commented 4 years ago

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

dan9thsense commented 4 years ago

I'm still looking for an answer to this question.

kunaltyagi commented 4 years ago

New link to the tutorial mentioned by OP

kunaltyagi commented 4 years ago

The tutorial shows how to find best match from multiple templates to a single point cloud. If I understand your question correctly, you want to find all matches of a single template in a point cloud?

dan9thsense commented 4 years ago

Ideally, it would return all matches found, so that multiple templates could be searched for and if some of those templates have multiple matches, those would be returned rather than just the best match. If there were some metric on how good the match is, then I could use a threshold on that metric to avoid getting a huge number of low-quality matches.

However, simply returning all matches of a single template would be good enough.

kunaltyagi commented 4 years ago

Ideally, it would return all matches found

That's going to be difficult. IIRC, most registration algorithms are iteratively going to a better match. So if a good match is present, it's very difficult to not end up there.

I'll have to look at how that particular algorithm is working, but intuitively, I'd say your approach of removing the registered points is a good way of going about. I don't know if a better method exists. Pinging @SergioRAgostinho, who's (currently busy, but) working in registration for more detailed info.

SergioRAgostinho commented 4 years ago

If there were some metric on how good the match is, then I could use a threshold on that metric to avoid getting a huge number of low-quality matches.

Have a look into chamfer distance (after the template and match are aligned). That's usually what's used to compare how similar point clouds (or other shapes are).

See: http://openaccess.thecvf.com/content_ECCV_2018/papers/Tolga_Birdal_PPF-FoldNet_Unsupervised_Learning_ECCV_2018_paper.pdf

Equation 6. You don't need to take the max out of both. The average is also fine. It should give you an idea how to rank your matches.

mvieth commented 2 years ago

It looks like the question is answered. Otherwise, Stackoverflow or the Discord community chat would be good places to ask this. Also, the recognition module might have something for this purpose.