hough-transform

Detectings small circles on game minimap

好久不见. 提交于 2019-12-24 13:33:16
问题 i am stuck on this problem for like 20h. The quality is not every good because on 1080p video, the minimap is less than 300px / 300px I want to detect the 10 heros circles on this images: Like this: For background removal, i can use this: The heroes portrait circle radius are between 8 to 12 because a hero portrait is like 21x21px. With this code Mat minimapMat = mgcodecs.imread("minimap.png"); Mat minimapCleanMat = Imgcodecs.imread("minimapClean.png"); Mat minimapDiffMat = new Mat(); Core

How to find the coordinates of a point w.r.t another point on an image using OpenCV

╄→гoц情女王★ 提交于 2019-12-24 10:03:52
问题 Today I wrote a program for detecting circles using Hough Transform using OpenCV in C. The program inputs 3 images, each image contains a fixed small circle and a big circle with variable position. The program then recognizes both the circles and marks the centres of both the circles. Now what I want to do is that in the output image the (x,y) coordinates of the centre of the bigger circle should be displayed with respect to the centre of the fixed smaller circle . Here's the code for 'circle

Delete segmented lines (OpenCV, Python)

邮差的信 提交于 2019-12-24 07:46:41
问题 Given the followig code: import numpy as np import cv2 gray = cv2.imread('image.png') edges = cv2.Canny(gray,50,150,apertureSize = 3) cv2.imwrite('edges-50-150.jpg',edges) minLineLength=100 lines = cv2.HoughLinesP(image=edges,rho=1,theta=np.pi/180, threshold=100,lines=np.array([]), minLineLength=minLineLength,maxLineGap=80) a,b,c = lines.shape for i in range(a): cv2.line(gray, (lines[i][0][0], lines[i][0][1]), (lines[i][0][2], lines[i][0][3]), (0, 0, 255), 1, cv2.LINE_AA) cv2.imwrite(

Error using HoughCircles with 3-channel input

[亡魂溺海] 提交于 2019-12-23 19:20:11
问题 Before detecting circles, I am replacing the red channel with the green channel. After replacing the channel, I pass it through a blur filter and then do a Hough transform to detect circles. But as I do this, I get a crappy error message: OpenCV(3.4.1) Error: Assertion failed (!_image.empty() && _image.type() == (((0) & ((1 << 3) - 1)) + (((1)-1) << 3)) && (_image.isMat() || _image.isUMat())) in HoughCircles, file /io/opencv/modules/imgproc/src/hough.cpp, line 1659 Traceback (most recent call

Probabilistic Hough transform in OpenCV 2.4.9 (Python)

女生的网名这么多〃 提交于 2019-12-23 15:25:37
问题 My question is about Hough transform in OpenCV 2.4.9 (Python). Here is an extract from tutorial: cv2.HoughLinesP(image, rho, theta, threshold[, lines[, minLineLength[, maxLineGap]]]) → lines I do not really understand what "lines[," means. I use the function in the following manner: lines = cv2.HoughLinesP(edges, 1, np.pi/180, 25, 2,25,115) But what does parameter "2" here really mean? Seems nothing change when I assign different values for that parameter. Tnanks.. 回答1: You have to use it

How to convert coordinates back to image (x,y) from hough transformation (rho, theta)?

☆樱花仙子☆ 提交于 2019-12-23 10:07:53
问题 I have a vector of lines produced by calling hough transformation function in Opencv, and need to convert them back to image coordinates. I found this piece of sample code from Opencv's official documentation, but I don't understand it. Would any one explain please? for( size_t i = 0; i < lines->size(); i++ ) { float rho = lines->at(i)[0]; //[0] is rho float theta = lines->at(i)[1]; //[1] is theta double a = cos(theta), b = sin(theta); double x0 = a*rho, y0 = b*rho; cv::Point pt1(cvRound(x0 +

CUDA implementation of the Circle Hough Transform

我的未来我决定 提交于 2019-12-22 01:32:03
问题 I'm trying to implement a maximum performance Circle Hough Transform in CUDA, whereby edge pixel coordinates cast votes in the hough space. Pseudo code for the CHT is as follows, I'm using image sizes of 256 x 256 pixels: int maxRadius = 100; int minRadius = 20; int imageWidth = 256; int imageHeight = 256; int houghSpace[imageWidth x imageHeight * maxRadius]; for(int radius = minRadius; radius < maxRadius; ++radius) { for(float theta = 0.0; theta < 180.0; ++theta) { xCenter = edgeCoordinateX

accumulator filling for Hough transform

落爺英雄遲暮 提交于 2019-12-21 16:58:54
问题 I wrote a piece of code that needs to be optimized. Just felt like checking with community to see if that code is indeed optimal. It fills up the accumulator for the Hough transform. I actually just copy pasted most the code from the OpenCV library. Thanks! int i,j,n,index; for (i = 0;i<numrows;i++) { for (j = 0;j<numcols;j++) { if (img[i*numcols + j] == 100) { for (n = 300;n<600;n++) { index = cvRound(j*tabCos[n] + i * tabSin[n]) + (numrho-1)/2; accum[(n+1) * (numrho+2) + index+1]++; } } } }

Normalize car plate for OCR in OpenCV C++

两盒软妹~` 提交于 2019-12-21 12:36:56
问题 I'm doing some simple OCR car plate recognition system. I'm using HaarCascades to find car plate, and next i need to normalize this plate, to put it into my OCR module. I'm using floodfill to find main contours of a car plate, and then i perform Hough transform, to find upper and lower boarders of a car plate: Here's a part of code, where i perform Hough transform^ HoughLinesP(canny_img, lines, 1, CV_PI/180, 80, 80, 30 ); for ( size_t i = 0; i < lines.size(); i++ ) { line (output, Point(lines

Glasses detection

早过忘川 提交于 2019-12-21 09:34:32
问题 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