houghlinesp

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

Improve HoughLines for horizontal lines detect (Python, OpenCV)

久未见 提交于 2019-12-02 05:21:10
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.imshow('hough',img) cv2.waitKey(0) The best result I achieved by now is this: How can I improve it more,

Python OpenCV HoughLinesP Fails to Detect Lines

て烟熏妆下的殇ゞ 提交于 2019-11-29 10:28:43
问题 I am using OpenCV HoughlinesP to find horizontal and vertical lines. It is not finding any lines most of the time. Even when it finds a lines it is not even close to actual image. import cv2 import numpy as np img = cv2.imread('image_with_edges.jpg') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) flag,b = cv2.threshold(gray,0,255,cv2.THRESH_OTSU) element = cv2.getStructuringElement(cv2.MORPH_CROSS,(1,1)) cv2.erode(b,element) edges = cv2.Canny(b,10,100,apertureSize = 3) lines = cv2.HoughLinesP

Opencv python HoughLinesP strange results

大兔子大兔子 提交于 2019-11-28 10:26:57
I'm trying to get the same result they got in this tutorial for HoughLinesP filter. I took same images and same threshold values like this : import cv2 from line import Line import numpy as np img = cv2.imread('building.jpg',1) cannied = cv2.Canny(img, 50, 200, 3) lines = cv2.HoughLinesP(cannied, 1, np.pi / 180, 80, 30, 10) for leftx, boty, rightx, topy in lines[0]: line = Line((leftx, boty), (rightx,topy)) line.draw(img, (255, 255, 0), 2) cv2.imwrite('lines.png',img) cv2.imwrite('canniedHouse.png',cannied) cv2.waitKey(0) cv2.destroyAllWindows() Line class is a custom class that does not do

OpenCV houghLinesP parameters

不想你离开。 提交于 2019-11-27 17:26:21
问题 I am having difficulty finding the lines on a chessboard in this image using HoughLinesP with OpenCV in Python. In an attempt to understand the parameters of HoughLinesP, I have come up with the following code: import numpy as np import cv2 from matplotlib import pyplot as plt from matplotlib import image as image I = image.imread('chess.jpg') G = cv2.cvtColor(I, cv2.COLOR_BGR2GRAY) # Canny Edge Detection: Threshold1 = 150; Threshold2 = 350; FilterSize = 5 E = cv2.Canny(G, Threshold1,

Opencv python HoughLinesP strange results

放肆的年华 提交于 2019-11-27 04:40:02
问题 I'm trying to get the same result they got in this tutorial for HoughLinesP filter. I took same images and same threshold values like this : import cv2 from line import Line import numpy as np img = cv2.imread('building.jpg',1) cannied = cv2.Canny(img, 50, 200, 3) lines = cv2.HoughLinesP(cannied, 1, np.pi / 180, 80, 30, 10) for leftx, boty, rightx, topy in lines[0]: line = Line((leftx, boty), (rightx,topy)) line.draw(img, (255, 255, 0), 2) cv2.imwrite('lines.png',img) cv2.imwrite(