Skip to content

HoughLines: min_theta behavior #21983

@e7p

Description

@e7p

The behavior of min_theta in the function HoughLines seems to be wrong, at least in the python opencv library that I refer to in this issue. The problem is that min_theta needs to be too low for my opinion, as otherwise lines won't get detected.

System information (version)
  • OpenCV => 4.5.5
  • Operating System / Platform => Arch Linux 64-bit
  • Python => 3.10.4
Detailed description

Horizontal lines can only be detected if the min_theta is less or equal 0.0001. The expected behavior would be, that min_theta can get as large as pi / 2 minus a sufficient tolerance.

Steps to reproduce
import cv2 as cv
import math

img = cv.imread('houghlines_test.png', cv.IMREAD_GRAYSCALE)
lines = cv.HoughLines(img, 1, math.pi/180, 90, min_theta=0.0001, max_theta=1.58)
print(lines)
lines = cv.HoughLines(img, 1, math.pi/180, 90, min_theta=0.001, max_theta=1.58)
print(lines)

houghlines_test.png:
houghlines_test

Output:

[[[100.          1.5708964]]]
None

Expected output would be two times the first line.

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    category: imgprocneeds investigationCollect and attach more details (build flags, stacktraces, input dumps, etc)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions