Commit 49e6002d authored by Davis King's avatar Davis King

Fixed hough_transform::find_pixels_voting_for_lines(). It would sometimes

include a pixel multiple times in the output lists.
parent d0fc6023
...@@ -365,7 +365,11 @@ namespace dlib ...@@ -365,7 +365,11 @@ namespace dlib
{ {
auto idx = hmap(hough_point.y(), hough_point.x()); auto idx = hmap(hough_point.y(), hough_point.x());
if (idx < constituent_points.size()) if (idx < constituent_points.size())
constituent_points[idx].push_back(img_point); {
// don't add img_point if it's already in the list.
if (constituent_points[idx].size() == 0 || constituent_points[idx].back() != img_point)
constituent_points[idx].push_back(img_point);
}
}; };
perform_generic_hough_transform(img, box, record_hit); perform_generic_hough_transform(img, box, record_hit);
......
...@@ -240,9 +240,9 @@ namespace dlib ...@@ -240,9 +240,9 @@ namespace dlib
that if angle_window_size or radius_window_size are made so large that if angle_window_size or radius_window_size are made so large
that HP[i] overlaps HP[j] for i!=j then the overlapping regions that HP[i] overlaps HP[j] for i!=j then the overlapping regions
of Hough space are assigned to HP[i] or HP[j] arbitrarily. of Hough space are assigned to HP[i] or HP[j] arbitrarily.
Therefore, all points in CONSTITUENT_POINTS are unique, that is, That is, we treat HP[i] and HP[j] as disjoint even if their boxes
there is no overlap in points between any two elements of overlap. In this case, the overlapping region is assigned to
CONSTITUENT_POINTS. either HP[i] or HP[j] in an arbitrary manner.
!*/ !*/
template < template <
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment