hough-transform

Detect touching/overlapping circles/ellipses with OpenCV and Python

一笑奈何 提交于 2019-11-28 15:33:31
问题 i want to measure the circularity of circles (difference of the "circles" height and width or ellipse parameters). The circles are given in pictures as shown here: After doing usual stuff like color2gray, thresholding and border detection, I get the following picture as shown: With this, I already tried a lot of different things: List item Watershed with findContour (similar to this question) -> openCV detects the space between the circles as a closed contour and not the circles since they

Algorithm to detect corners of paper sheet in photo

点点圈 提交于 2019-11-28 14:56:03
What is the best way to detect the corners of an invoice/receipt/sheet-of-paper in a photo? This is to be used for subsequent perspective correction, before OCR. My current approach has been: RGB > Gray > Canny Edge Detection with thresholding > Dilate(1) > Remove small objects(6) > clear boarder objects > pick larges blog based on Convex Area. > [corner detection - Not implemented] I can't help but think there must be a more robust 'intelligent'/statistical approach to handle this type of segmentation. I don't have a lot of training examples, but I could probably get 100 images together.

Circular Hough Transform misses circles

我是研究僧i 提交于 2019-11-28 10:27:45
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 point me at the right direction. import cv2 import cv2.cv as cv import numpy as np import math # Load

Ellipse Detection using Hough Transform

吃可爱长大的小学妹 提交于 2019-11-28 10:21:10
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);%Used for Major Axis Comparison Local_Threshold = ceil(Size_Ellipse(1)/25);%Used for Minor Axis

HoughCircles Parameters to recognise balls

柔情痞子 提交于 2019-11-28 09:27:58
After processing an image by converting it to grey scale and then blurring it, I'm trying to apply a Hough Circle Transformation with these parameters: CV_HOUGH_GRADIENT dp = 1 min_dist = 1 param_1 = 70 param_2 = 100 min_radius = 0 max_radius = 0 Here is one of the many images I've tried: http://i.stack.imgur.com/JGRiM.jpg But the algorithm fails to recognise the ball even with relaxed parameters. (When I try it with an image of a circle created in GIMP it works fine) I agree with krzych. I had it working effortlessly with : cv::Mat img,img2; std::vector<cv::Vec3f> circles; img = cv::imread(

Rectangle detection with Hough transform

╄→гoц情女王★ 提交于 2019-11-28 04:09:53
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? tzenes For those of you wondering about the paper, it's: Rectangle Detection based on a Windowed Hough Transform by Cláudio Rosito Jung and

Why HoughCircles returns 0 circles while trying to detect irises?

喜欢而已 提交于 2019-11-28 01:54:56
问题 I am trying to detect the eyes' irises but HoughCircles returns 0 circles. The input image(eyes) is: Then I made the following things with this image: cvtColor(eyes, gray, CV_BGR2GRAY); morphologyEx(gray, gray, 4,cv::getStructuringElement(cv::MORPH_RECT,cv::Size(3,3))); threshold(gray, gray, 0, 255, THRESH_OTSU); vector<Vec3f> circles; HoughCircles(gray, circles, CV_HOUGH_GRADIENT, 2, gray.rows/4); if (circles.size()) cout << "found" << endl; So the final gray image looks like this: I've

Android OpenCV Drawing Hough Lines

橙三吉。 提交于 2019-11-27 18:36:34
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 you need more information. capture.retrieve(mGray, Highgui.CV_CAP_ANDROID_GREY_FRAME); Imgproc.Canny

Fine Tuning Hough Line function parameters OpenCV

↘锁芯ラ 提交于 2019-11-27 13:50:10
I've been trying to get 4 lines around the square so that I can obtain the vertices of the square. I'm going with this approach rather than finding corners directly using Harris or contours method due to accuracy. Using houghlines in built function in opencv I'm unable to get full length lines to get intersection points and I'm also getting too many irrelevant lines. I'd like to know if the parameters can be fine tuned to obtain my requirements? If yes how do I go about it? My question is exactly the same as this one here. However I'm not getting those lines itself even after changing those

Algorithm to detect corners of paper sheet in photo

心不动则不痛 提交于 2019-11-27 08:56:33
问题 What is the best way to detect the corners of an invoice/receipt/sheet-of-paper in a photo? This is to be used for subsequent perspective correction, before OCR. My current approach has been: RGB > Gray > Canny Edge Detection with thresholding > Dilate(1) > Remove small objects(6) > clear boarder objects > pick larges blog based on Convex Area. > [corner detection - Not implemented] I can't help but think there must be a more robust 'intelligent'/statistical approach to handle this type of