Bug in ImageLinePruneMerge.pruneSimilar

14 views
Skip to first unread message

Erhan Erdemir

unread,
Mar 1, 2023, 7:20:17 PM3/1/23
to BoofCV
I think there is a small bug in the function

ImageLinePruneMerge.pruneSimilar

The relevant snippet is as below:

// now just see if they are very close
float distA = Distance2D_F32.distance(a, b.a);
float distB = Distance2D_F32.distance(a, b.b);

if (distA > toleranceDist && distB > toleranceDist) {
continue;
}

distA = Distance2D_F32.distance(b, b.a);
distB = Distance2D_F32.distance(b, b.b);

if (distA > toleranceDist && distB > toleranceDist) {
continue;
}

It first finds and checks the distance between line a and end points of line b.
Then it finds and checks the distance between line b and end points of line b.

I think the second one is wrong. It should find and check the distance between line a (not b) and end points of line b.

Thanks

Peter A

unread,
Mar 9, 2023, 2:03:33 PM3/9/23
to boo...@googlegroups.com
Hi Erhan,

I'll take a closer look at this soon. Just wanted to say something since it's been over a week. Thanks for reporting this!

Cheers,
- Peter

--
You received this message because you are subscribed to the Google Groups "BoofCV" group.
To unsubscribe from this group and stop receiving emails from it, send an email to boofcv+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/boofcv/a26e5d5d-9117-4007-b913-fb6deb495f6bn%40googlegroups.com.


--
"Now, now my good man, this is no time for making enemies."    — Voltaire (1694-1778), on his deathbed in response to a priest asking that he renounce Satan.

Peter A

unread,
Apr 11, 2023, 1:10:00 AM4/11/23
to boo...@googlegroups.com
Yep definitely a bug. However I'm not sure if it makes a big difference or not. Added a unit test (there was none before) and had trouble causing the old code to generate a mistake. After thinking about it I believe in the nominal situation the two sets of distances will be identical. It might not be the case if they intersect different parts of the image border.


This will be merged once it's been verified to not cause any performance issues.
Reply all
Reply to author
Forward
0 new messages