hough-transform

how to use hough circles in cv2 with python?

一世执手 提交于 2019-11-27 06:42:46
问题 I have the following code and I want to detect the circle. img = cv2.imread("act_circle.png") gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) circles = cv2.HoughCircles(gray,cv2.CV_HOUGH_GRADIENT) it looks like it does not have the attribute and the error is the following 'module' object has no attribute 'CV_HOUGH_GRADIENT' Does anybody know where this hidden parameters is? Thanks 回答1: CV_HOUGH_GRADIENT belongs to the cv module, so you'll need to import that: import cv2.cv as cv and change your

Circular Hough Transform misses circles

那年仲夏 提交于 2019-11-27 03:44:58
问题 I've read a lot about the Circular Hough transform on Stack Overflow, but I seem to be missing something. I wrote a program that is supposed to detect the circles of a "Bull's Eye" target. However, even after playing with the parameters, the algorithm is quite bad - it ignores most of the circles and one time it finds a circle but seems to "wander off". I've even tried applying an "Unsharp Mask" to no avail. I have added my code, the image I started with and the output. I hope someone can

Ellipse Detection using Hough Transform

馋奶兔 提交于 2019-11-27 03:31:22
问题 using Hough Transform, how can I detect and get coordinates of (x0,y0) and "a" and "b" of an ellipse in 2D space? This is ellipse01.bmp: I = imread('ellipse01.bmp'); [m n] = size(I); c=0; for i=1:m for j=1:n if I(i,j)==1 c=c+1; p(c,1)=i; p(c,2)=j; end end end Edges=transpose(p); Size_Ellipse = size(Edges); B = 1:ceil(Size_Ellipse(1)/2); Acc = zeros(length(B),1); a1=0;a2=0;b1=0;b2=0; Ellipse_Minor=[];Ellipse_Major=[];Ellipse_X0 = [];Ellipse_Y0 = []; Global_Threshold = ceil(Size_Ellipse(2)/6);

Horizontal Line detection with OpenCV

雨燕双飞 提交于 2019-11-27 03:01:43
I am trying to find horizontal and vertical lines from an image which came from a "document". The documents are scanned pages from contracts and so the lines look like what you would see in a table or in a contract block. I have been trying OpenCV for the job. The Hough transform implementation in OpenCV seemed useful for the job, but I could not find any combination of parameters that would allow it to cleanly find the vertical and horizontal lines. I tried with and without edge detection. No luck. If anyone has done anything similar I'm interested in knowing how. See here an image of my

Android OpenCV Drawing Hough Lines

家住魔仙堡 提交于 2019-11-26 19:31:16
问题 I am trying to use OpenCV on an android phone to detect lines. I modified the 'Tutorial 1 Basic - 2. Use OpenCV Camera' sample. I am also using Hough Line Transform as an example. However, I am getting weird numbers (at least what I believe to be weird numbers) for the points. In the range 1000 to -1000 for b. I don't fully understand the code (mostly the part about adding/subtracting 1000 * (a or -b)). In the end I do not see the lines at all. Could anyone give me a hand? Also let me know if

Rectangle detection with Hough transform

ⅰ亾dé卋堺 提交于 2019-11-26 19:19:08
问题 I'm trying to implement rectangle detection using the Hough transform, based on this paper. I programmed it using Matlab, but after the detection of parallel pair lines and orthogonal pairs, I must detect the intersection of these pairs. My question is about the quality of the two line intersection in Hough space. I found the intersection points by solving four equation systems. Do these intersection points lie in cartesian or polar coordinate space? 回答1: For those of you wondering about the

Peak-finding algorithm for Python/SciPy

柔情痞子 提交于 2019-11-26 19:17:47
I can write something myself by finding zero-crossings of the first derivative or something, but it seems like a common-enough function to be included in standard libraries. Anyone know of one? My particular application is a 2D array, but usually it would be used for finding peaks in FFTs, etc. Specifically, in these kinds of problems, there are multiple strong peaks, and then lots of smaller "peaks" that are just caused by noise that should be ignored. These are just examples; not my actual data: 1-dimensional peaks: 2-dimensional peaks: The peak-finding algorithm would find the location of

Peak-finding algorithm for Python/SciPy

大憨熊 提交于 2019-11-26 06:10:00
问题 I can write something myself by finding zero-crossings of the first derivative or something, but it seems like a common-enough function to be included in standard libraries. Anyone know of one? My particular application is a 2D array, but usually it would be used for finding peaks in FFTs, etc. Specifically, in these kinds of problems, there are multiple strong peaks, and then lots of smaller \"peaks\" that are just caused by noise that should be ignored. These are just examples; not my

Detect semi-circle in opencv

走远了吗. 提交于 2019-11-26 00:54:55
问题 I am trying to detect full circles and semicircles in an image. I am following the below mentioned procedure : Process image (including Canny edge detection) Find contours and draw them on an empty image, so that I can eliminate unwanted components. (The processed image is exactly what I want.) Detect circles using HoughCircles. And this is what I get. I tried varying the parameters in HoughCircles but the results are not consistent as it varies based on lighting and the position of circles

Detect semi-circle in opencv

岁酱吖の 提交于 2019-11-25 19:17:44
I am trying to detect full circles and semicircles in an image. I am following the below mentioned procedure : Process image (including Canny edge detection) Find contours and draw them on an empty image, so that I can eliminate unwanted components. (The processed image is exactly what I want.) Detect circles using HoughCircles. And this is what I get. I tried varying the parameters in HoughCircles but the results are not consistent as it varies based on lighting and the position of circles in image. I accept or reject a circle based on it's size. So the result is not acceptable. Also I have a