hough-transform

Improve HoughLines for horizontal lines detect (Python, OpenCV)

萝らか妹 提交于 2019-12-04 05:32:01
问题 I have this source image: My goal is to remove the bottom line while keep the letters/numbers untouched. This is the code I use: import cv2 import numpy as np img = cv2.imread('src.png') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray,100,200,apertureSize = 5) minLineLength = 0 maxLineGap = 19 lines = cv2.HoughLinesP(edges,1,np.pi/180,15,minLineLength,maxLineGap) for x in range(0, len(lines)): for x1,y1,x2,y2 in lines[x]: cv2.line(img,(x1,y1),(x2,y2),(255,255,255),2) cv2

Glasses detection

半腔热情 提交于 2019-12-04 04:33:31
What I'm trying to do is measure the thickness of the eyeglasses frames. I had the idea to measure the thickness of the frame's contours (may be a better way?). I have so far outlined the frame of the glasses, but there are gaps where the lines don't meet. I thought about using HoughLinesP, but I'm not sure if this is what I need. So far I have conducted the following steps: Convert image to grayscale Create ROI around the eye/glasses area Blur the image Dilate the image (have done this to remove any thin framed glasses) Conduct Canny edge detection Found contours These are the results: This

Understanding Hough Transform [closed]

人盡茶涼 提交于 2019-12-04 01:52:58
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I am trying to understand MATLAB's code for the Hough Transform. Some items are clear to me in this picture, binary_image is the monochrome version of input_image . hough_lines is a vector containing detected lines in the image. I see that, four lines have been detected. T contain

Python cv2 HoughLines grid line detection

杀马特。学长 韩版系。学妹 提交于 2019-12-03 16:36:11
I have a simple grid in an image, I am trying to determine the grid size, e.g. 6x6, 12x12, etc. Using Python and cv2. I am testing it with the above 3x3 grid, I was planning to determine the grid size by counting how many vertical / horizontal lines there are by detecting them in the image: import cv2 import numpy as np im = cv2.imread('photo2.JPG') gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY) imgSplit = cv2.split(im) flag,b = cv2.threshold(imgSplit[2],0,255,cv2.THRESH_OTSU) element = cv2.getStructuringElement(cv2.MORPH_CROSS,(1,1)) cv2.erode(b,element) edges = cv2.Canny(b,150,200,3,5) while

Improving circle detection

与世无争的帅哥 提交于 2019-12-03 16:17:42
I am trying to detect circles in my images. I have written the following code in C# using EmguCV. Most of the times it works, but there are some cases that it detects smaller or larger circles that are slightly shifted to a side. Here is my code: Thread.Sleep(1000); imgCrp.Save(DateTime.Now.ToString("yyMMddHHmmss") + ".jpg"); imgCrpLab = imgCrp.Convert<Lab, Byte>(); imgIsolatedCathNTipBW = new Image<Gray, Byte>(imgCrp.Size); CvInvoke.cvInRangeS(imgCrpLab.Split()[2], new MCvScalar(0), new MCvScalar(100), imgIsolatedCathNTipBW); imgCrpNoBgrnd = imgCrp.Copy(imgIsolatedCathNTipBW.Not());

What is the particular implementation of Probabilistic Hough Transform in OpenCV?

假装没事ソ 提交于 2019-12-03 07:34:59
Does anyone know the particular algorithm for Probabilistic Hough Transform in the OpenCV's implementation? I mean, is there a reference paper or documentation about the algorithm? To get the idea, I can certainly look into the source code, but I wonder if there is any documentation about it. -- it's not in the source code's comments (OpenCV 1.0). Thank you! -Jin Here's an article about the Randomized Hough Transform which i believe to be the same as the "probabilistic Hough transform" used in OpenCV http://en.wikipedia.org/wiki/Randomized_Hough_Transform basically, you dont fill up the

Choosing Lines From Hough Lines

爱⌒轻易说出口 提交于 2019-12-03 07:22:53
I'm using Hough Lines to do corner detection for this image. i plan to find the intersection of the lines as the corner. This is the image. Unfortunately, Hough return lots of lines for each line I expect How do I tune the Hough Lines so there is only four lines each corresponds to actual line on the image? Rahul galgali Collect the intersection of all line for (int i = 0; i < lines.size(); i++) { for (int j = i + 1; j < lines.size(); j++) { cv::Point2f pt = computeIntersectionOfTwoLine(lines[i], lines[j]); if (pt.x >= 0 && pt.y >= 0 && pt.x < image.cols && pt.y < image.rows) { corners.push

Recognize a number from an image

独自空忆成欢 提交于 2019-12-03 03:34:19
问题 I'm trying to write an application to find the numbers inside an image and add them up. How can I identify the written number in an image? There are many boxes in the image I need to get the numbers in the left side and sum them to give total. How can I achieve this? Edit: i did a java tesseract ocr on the image but i didnt get any correct results. how can i train it? also i did a edge detection i got this: 回答1: You will most likely need to do the following: Apply the Hough Transform

A good approach for detecting lines in an image?

旧巷老猫 提交于 2019-12-03 01:58:20
问题 I've written some code that uses OpenCV libraries to detect white lines painted on grass. I need someone's opinion on the approach I used (as I'm sure there's a much better way than mine). Also, the results I'm getting are not as good as I expected because slight variations in the image require tweaking the parameters (and I need to operate on fixed parameters). My approach so far: Grab image from webcam (and turn into grayscale obviously) Run it through a threshold filter (using THRESH_TO

Recognize a number from an image

六月ゝ 毕业季﹏ 提交于 2019-12-02 17:04:43
I'm trying to write an application to find the numbers inside an image and add them up. How can I identify the written number in an image? There are many boxes in the image I need to get the numbers in the left side and sum them to give total. How can I achieve this? Edit: i did a java tesseract ocr on the image but i didnt get any correct results. how can i train it? also i did a edge detection i got this: You will most likely need to do the following: Apply the Hough Transform algorithm on the entire page, this should should yield a series of page sections. For each section you get, apply it