Questions tagged [houghlines]
47 questions
5
votes
2 answers
In what order, OpenCV's HoughLines lists the detected lines in the [rho,theta] matrix?
When a given image with lines is passed to OpenCV's HoughLine transform, it returns a list of rho and theta pairs, each pair defining an individual line. What is the order in which lines are listed in this list of rho,theta pairs.
for eg, when this…

Pranjal Agarwal
- 313
- 2
- 8
4
votes
0 answers
What is meant by the values returned by cv2.HoughLinesP()?
lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength,maxLineGap,cv2.THRESH_BINARY)
I am using this code to detect line in a PNG image, and the function returns a numpy array :
array([[[124, 235, 393, 235]],
[[124, 233, 393,…

MSD
- 154
- 2
- 12
3
votes
1 answer
How to find perpendicular lines in polar coordinates?
Say I have the lines shown in the image below, represented in polar coordinate format (rho and theta). These lines are the output of OpenCV's HoughLines function after some post processing. (Sorry I'm not allowed to embed images yet.)
What I want…

Michael Walker
- 41
- 3
2
votes
1 answer
Houghlines not reaching edge of image
I am trying to detect all the lines in the following image:
Using the following code I am able to detect almost all lines:
%Find the line detected
I = imread('img3.png');
J = histeq(I);
BW = edge(J,'canny');
[H,T,R] = hough(BW);
P =…

Joe Taylor
- 157
- 1
- 3
- 12
2
votes
1 answer
How to count lines in an image with python, openCV
I want to count paper, so I am thinking about using line detection. I have tried some methods like Canny, HoughLines, and FLD. But I only get the processed photo. I have no idea how to count it. There are some small line segments that are the lines…

ZZZZZBON
- 21
- 1
- 2
2
votes
1 answer
Detecting boxes via Hough Transform
Using HoughTransform I am trying to detect boxes and provide for a distinct color.
So far my understanding is a box is horizontal and vertical line .
my code is
lines = cv2.HoughLines(edges,1,np.pi/180, 50)
# The below for loop runs till r and…

IamKarim1992
- 646
- 5
- 20
2
votes
1 answer
Automatic Skew correction using opencv
I want a way to automatically detect and correct skew of a image of a receipt,
I tried to find variance between the rows for various angles of rotation and choose the angle which has the the maximum variance.
To calculate variance I did the…

Yash Gupta
- 187
- 2
- 11
2
votes
1 answer
How to draw a desired line from HoughLines function output in OpenCV C++?
Context :
Page No 8 in this lecture says that the OpenCV HoughLines function returns an N x 2 array of line parameters rho and theta which is stored in the array called lines.
Then in order to actually create the lines from these angles, we have…

Arun Kumar
- 634
- 2
- 12
- 26
1
vote
0 answers
How to crop image on the detected houghlines?
I am developing a book spine detection solution. For that I am trying to crop the image using the hough lines detected. However I am stuck at this phase. Here's the code which I am using to detect the book spines:
image =…

Watermelon 23
- 11
- 1
1
vote
0 answers
From Hough Circle detection to coin separation
For an image analysis problem I'm trying to separate 11 unique, partly overlapping, coins and output an image with the coins separated and displayed in 11 different colors. I've done a Hough Circle Detection and found the individual circles.
Now I…

Paul Engelbert
- 97
- 7
1
vote
0 answers
Is there any method to Average out close lines detected in houghlines?
I have to detect appropriate rectangles (which satisfy the area and aspect ratio condition of doors) from an image to find Doors in it. So I used canny edge detection to find the edges and then I used hough Transform to extract lines for the edges.…

SameeranZingre
- 11
- 1
1
vote
0 answers
Hough transform: How to get lines from voting-matrix?
so Im trying to implement the hough transform using python and c++ (using Pybind11 for interfacing between the two languages). When Im plotting the hough space it seems alright but I just can't get a line from the maximum of the voting matrix.
Here…

Theodor Peifer
- 3,097
- 4
- 17
- 30
1
vote
1 answer
How can I prevent HoughLines from detecting certain lines multiple times
So I'm working on this piece of code to extract data from some graphs in images. These images are all scanned from a book. Since we're talking about 100+ images here, I would like to automate the process of course. My first step was to make sure…

Frederik Vanclooster
- 443
- 1
- 7
- 21
1
vote
1 answer
Python OpenCV: Hough Transform does not detect obvious lines
Problem:
I want to detect lines in a given image using OpenCV in Python. Although there are multiple obvious vertical lines, neither normal HoughLines nor probabilistic HoughLines does find them. As I spent plenty of time playing around with the…

kletterer
- 11
- 3
1
vote
2 answers
line detection using HoughLines in opencv
I want to detect lines in a picture like this:
And my code is like this:
import numpy as np
import cv2
import math
# prepare the image
image = cv2.imread("image")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray,…

captainst
- 617
- 1
- 7
- 20