hough-transform

Opencv - detecting whether the eye is closed or open

谁都会走 提交于 2019-11-30 10:34:53
Hi guys I am working on a project where we are trying to detect whether the eye is closed or open in a picture ... what we done so far is that we detected the face then the eyes and then we applied hough transform hoping that the Iris would be the only circle when the eye is open the problem is that when the eye is closed ... it produces a circle as well Here is the code: import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.core.Size; import org

HoughLines transform in opencv

混江龙づ霸主 提交于 2019-11-30 10:27:22
I am working on image processing using opencv and Eclipse. vector<Vec2f> lines; HoughLines(dst, lines, 1, CV_PI/180, 100, 0, 0 ); for( size_t i = 0; i < lines.size(); i++ ) { float rho = lines[i][0], theta = lines[i][1]; Point pt1, pt2; double a = cos(theta), b = sin(theta); double x0 = a*rho, y0 = b*rho; pt1.x = cvRound(x0 + 1000*(-b)); pt1.y = cvRound(y0 + 1000*(a)); pt2.x = cvRound(x0 - 1000*(-b)); pt2.y = cvRound(y0 - 1000*(a)); line( cdst, pt1, pt2, Scalar(0,0,255), 3, CV_AA); } Can anyone explain that how the points are being defined by this code. We are using y=(-cos(theta)/sin(theta))x

OpenCV: Using Hough Circle Transformation to detect iris

你离开我真会死。 提交于 2019-11-30 08:37:01
问题 I am newbie to openCV, but I want to create iris recognition program. Although the system with webcam can detect the eyes, it cannot, however, detect the circular iris. I am using the Hough Circle Transformation. But in case iris in an image is not circular enough, system can't detect it. Any solution for it? the algorithm used is Hough Circle Transformation. IplImage *capturedImg = cvLoadImage("circle.jpg",1); IplImage *grayscaleImg = cvCreateImage(cvGetSize(capturedImg), 8, 1); cvCvtColor

find intersection point of two lines drawn using houghlines opencv

我们两清 提交于 2019-11-29 20:31:07
How can I get the intersection points of lines down using opencv Hough lines algorithm? Here is my code: import cv2 import numpy as np import imutils im = cv2.imread('../data/test1.jpg') gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray, 60, 150, apertureSize=3) img = im.copy() lines = cv2.HoughLines(edges,1,np.pi/180,200) for line in lines: for rho,theta in line: a = np.cos(theta) b = np.sin(theta) x0 = a*rho y0 = b*rho x1 = int(x0 + 3000*(-b)) y1 = int(y0 + 3000*(a)) x2 = int(x0 - 3000*(-b)) y2 = int(y0 - 3000*(a)) cv2.line(img,(x1,y1),(x2,y2),(0,255,0),10) cv2.imshow(

Houghlines in MATLAB

烂漫一生 提交于 2019-11-29 12:08:10
After detecting the lines in an image using Hough lines , how can I use it to calculate the change in angle (rotation) of the lines of a reference image? Amro Note to readers: This is a follow-up question, refer to these for background: How to select maximum intensity in Hough transform in MATLAB? Calculating displacement moved in MATLAB The process is similar to what I showed before. Below I am using the images from your previous question (since you provided only one, I created the other by rotating the first by 10 degrees). We start by detecting the lines for the two images. We do this with

OpenCV Hough strongest lines

独自空忆成欢 提交于 2019-11-29 12:06:09
问题 Do the HoughLines or HoughLinesP functions in OpenCV return the list of lines in accumulator order like the HoughCircles function does? I would like to know the ordering of lines. It would also be very handy to get a the accumulator value for the lines so an intelligent and adaptive threshold could be used instead of a fixed one. Are either the ordering or the accumulator value available without rewriting OpenCV myself? 回答1: HoughTransform orders lines descending by number of votes. You can

How to merge lines after HoughLinesP?

落花浮王杯 提交于 2019-11-29 09:53:41
问题 My task is to find coordinates of lines (startX, startY, endX, endY) and rectangles (4 lines). Here is input file: I use the next code: img = cv2.imread(image_src) gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret, thresh1 = cv2.threshold(gray,127,255,cv2.THRESH_BINARY) edges = cv2.Canny(thresh1,50,150,apertureSize = 3) minLineLength = 100 maxLineGap = 10 lines = cv2.HoughLinesP(edges,1,np.pi/180,10,minLineLength,maxLineGap) print(len(lines)) for line in lines: cv2.line(img,(line[0][0],line[0]

Why HoughCircles returns 0 circles while trying to detect irises?

人盡茶涼 提交于 2019-11-29 08:22:21
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 found this question Using HoughCircles to detect and measure pupil and iris but it didn't help me despite

OpenCV: Using Hough Circle Transformation to detect iris

随声附和 提交于 2019-11-29 07:05:29
I am newbie to openCV, but I want to create iris recognition program. Although the system with webcam can detect the eyes, it cannot, however, detect the circular iris. I am using the Hough Circle Transformation. But in case iris in an image is not circular enough, system can't detect it. Any solution for it? the algorithm used is Hough Circle Transformation. IplImage *capturedImg = cvLoadImage("circle.jpg",1); IplImage *grayscaleImg = cvCreateImage(cvGetSize(capturedImg), 8, 1); cvCvtColor(capturedImg, grayscaleImg, CV_BGR2GRAY); // Gaussian filter for less noise cvSmooth(grayscaleImg,

Python How to detect vertical and horizontal lines in an image with HoughLines with OpenCV?

送分小仙女□ 提交于 2019-11-28 19:41:16
I m trying to obtain a threshold of the calibration chessboard. I cant detect directly the chessboard corners as there is some dust as i observe a micro chessboard. I try several methods and HoughLinesP seems to be the easiest approach. But the results are not good, how to improve my results? import numpy as np import cv2 img = cv2.imread('lines.jpg') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray,50,150,apertureSize = 3) print img.shape[1] print img.shape minLineLength=100 lines = cv2.HoughLinesP(image=edges,rho=0.02,theta=np.pi/500, threshold=10,lines=np.array([]),