mrozycki/rustmas

Detect incorrectly placed lights in 2D using convex hull area

Closed this issue · 0 comments

Similarly to #85, we can detect incorrectly detected lights at the 2D capture stage. This should be done before normalization, so that obviously wrong points do not throw off normalization. However, incorrectly detected lights in this case should not be completely thrown away, but instead be ignored when calculating bounds during normalization, so that a stray point does not completely change the bounds. The points should still be normalized and returned with lowered accuracy.

We can use multiple strategies for such detection. In the scope of this task, calculate the convex hull of all the detections (OpenCV has an implementation for that), and for each point on the hull try removing it and calculating how much it decreases the area of the hull. Lights that are far away from the tree should decrease the area of a hull by a significant amount.