Created
April 9, 2020 05:40
-
-
Save ryul99/548c41577113c5f8fca62448f8d20ca2 to your computer and use it in GitHub Desktop.
Line Detection with opencv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_lines(img_path): # return: [[left, top, right, bottom]...] | |
img = cv2.imread(img_path) | |
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) | |
return lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment