Fix angle discretization in Hough transforms
authorlamm45 <96844552+lamm45@users.noreply.github.com>
Sun, 26 Jun 2022 23:13:12 +0000 (19:13 -0400)
committerlamm45 <96844552+lamm45@users.noreply.github.com>
Tue, 30 Aug 2022 22:46:16 +0000 (18:46 -0400)
commit1f0bfc8d8350dc41c09e1151437d0164e94f69b4
tree1bbffc2a76a60f168253cefd263cd7ba4bd665d1
parent5e1c9099e8c32d3c96a8459c5bd8260382beec1a
Fix angle discretization in Hough transforms

In some situations the last value was missing from the discrete theta
values. Now, the last value is chosen such that it is close to the
user-provided maximum theta, while the distance to pi remains always
at least theta_step/2. This should avoid duplicate detections.

A better way would probably be to use max_theta as is and adjust the
resolution (theta_step) instead, such that the discretization would
always be uniform (in a circular sense) when full angle range is used.
modules/imgproc/include/opencv2/imgproc.hpp
modules/imgproc/src/hough.cpp
modules/imgproc/test/test_houghlines.cpp