OpenCV

Why the function cv2.HoughLinesP() has different effects?

给你一囗甜甜゛ 提交于 2021-02-10 11:06:23
问题 I learn in this link. This is the original picture: My test code: import cv2 import numpy as np img = cv2.imread( 'E:/image/sudoku.png' ) gray = cv2.cvtColor( img,cv2.COLOR_BGR2GRAY ) edges = cv2.Canny( gray,50,150,apertureSize = 3 ) minLineLength = 100 maxLineGap = 10 lines = cv2.HoughLinesP( edges,1,np.pi/180,100,minLineLength,maxLineGap ) for line in lines: for x1,y1,x2,y2 in line: cv2.line( img,( x1,y1 ),( x2,y2 ),( 0,255,0 ),2 ) cv2.imwrite( 'E:/image/myhoughlinesp.jpg',img ) cv2.imshow(

Why the function cv2.HoughLinesP() has different effects?

隐身守侯 提交于 2021-02-10 11:05:35
问题 I learn in this link. This is the original picture: My test code: import cv2 import numpy as np img = cv2.imread( 'E:/image/sudoku.png' ) gray = cv2.cvtColor( img,cv2.COLOR_BGR2GRAY ) edges = cv2.Canny( gray,50,150,apertureSize = 3 ) minLineLength = 100 maxLineGap = 10 lines = cv2.HoughLinesP( edges,1,np.pi/180,100,minLineLength,maxLineGap ) for line in lines: for x1,y1,x2,y2 in line: cv2.line( img,( x1,y1 ),( x2,y2 ),( 0,255,0 ),2 ) cv2.imwrite( 'E:/image/myhoughlinesp.jpg',img ) cv2.imshow(

Detect rectangles in OpenCV (4.2.0) using Python (3.7),

谁都会走 提交于 2021-02-10 09:43:40
问题 I am working on a personal project where I detect rectangles (all the same dimensions) and then place those rectangles inside a list in the same order (top-bottom) and then process the information inside each rectangle using some function. Below is my test image. I have managed to detect the rectangle of interest, however I keep getting other rectangles that I don't want. As you can see I only want the three rectangles with the information (6,9,3) into a list. My code import cv2 width=700

how to increase the accuracy of Grabcut Algorithm using OpenCV?

久未见 提交于 2021-02-10 09:14:51
问题 I am using the grabcut algorithm of OpenCV for the background subtraction of an image in android. Algorithms runs fine but the result it gives is not accurate. E.g. My input image is: Output image look like: so How can we increase accuracy of Grabcut Algorithm? P.S: Apology for not uploading example images due to low reputation :( 回答1: I have been battling with the same problem for quite some time now. I have a few tips and tricks for this 1> Improve your seeds. Considering that GrabCut is

how to increase the accuracy of Grabcut Algorithm using OpenCV?

本小妞迷上赌 提交于 2021-02-10 09:13:27
问题 I am using the grabcut algorithm of OpenCV for the background subtraction of an image in android. Algorithms runs fine but the result it gives is not accurate. E.g. My input image is: Output image look like: so How can we increase accuracy of Grabcut Algorithm? P.S: Apology for not uploading example images due to low reputation :( 回答1: I have been battling with the same problem for quite some time now. I have a few tips and tricks for this 1> Improve your seeds. Considering that GrabCut is

how to increase the accuracy of Grabcut Algorithm using OpenCV?

亡梦爱人 提交于 2021-02-10 09:09:19
问题 I am using the grabcut algorithm of OpenCV for the background subtraction of an image in android. Algorithms runs fine but the result it gives is not accurate. E.g. My input image is: Output image look like: so How can we increase accuracy of Grabcut Algorithm? P.S: Apology for not uploading example images due to low reputation :( 回答1: I have been battling with the same problem for quite some time now. I have a few tips and tricks for this 1> Improve your seeds. Considering that GrabCut is

No GPU Support using OpenCv 2.4.10 + Cuda 7.5 + W10

不羁的心 提交于 2021-02-10 08:43:14
问题 Im trying to get GPU up and running using: OpenCv 2.4.10 Visual Studio 2013 Cuda toolkit 7.5 (cuda samples tested and running) Windows 10 x64 Lenovo Y50 with NVIDIA GEFORCE GTX 860M I have compiled OpenCv using CMake with WITH_CUDA=ON, and then installed the libraries by opening OpenCv.sln and built ALLBUILD and INSTALL projects. Set my Project configuration as: VC++ Directories include Directories: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include C:\OpenCv\opencv\build\install

Detect overlapping noisy circles in image

限于喜欢 提交于 2021-02-10 08:01:38
问题 I try to recognize two areas in the following image. The area inside the inner and the area between the outer and inner - the border - circle with python openCV. I tried different approaches like: Detecting circles images using opencv hough circles Find and draw contours using opencv python That does not fit very well. Is this even possible with classical image processing or do I need some neuronal networking? Edit: Detecting circles images using opencv hough circles # import the necessary

About Line detection by using OpenCV

半世苍凉 提交于 2021-02-10 07:53:39
问题 I try to mark the road in the following figure, the yellow middle lines and the white edge lines.: I use the standard code of Hough Transfrom. My code is as following: import cv2 import numpy as np img = cv2.imread('Road3.jpg') hsv = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) low_yellow=np.array([18, 94, 140]) up_yellow=np.array([48, 255, 255]) mask=cv2.inRange(hsv, low_yellow, up_yellow) edges = cv2.Canny(mask,75,150) lines = cv2.HoughLinesP(edges,1,np.pi/180,50,maxLineGap=250) for line in lines:

Using masks to apply different thresholds to different parts of an image

拟墨画扇 提交于 2021-02-10 07:08:24
问题 I have an image, in which I want to threshold part of the image within a circular region, and then the remainder of the image outside of this region. Unfortunately my attempts seem to be thresholding the image as a whole, ignoring the masks. How can this be properly achieved? See code attempt below. def circular_mask(h, w, centre=None, radius=None): if centre is None: # use the middle of the image centre = [int(w / 2), int(h / 2)] if radius is None: # use the smallest distance between the