Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy as np
- img = cv2.imread('.image.jpg')
- gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
- edges = cv2.Canny(gray, 500, 460)
- lines = cv2.HoughLinesP(edges, 1, np.pi/180, 30, maxLineGap=250)
- for line in lines:
- x1, y1, x2, y2 = line[0]
- cv2.line(img, (x1, y1), (x2, y2), (0, 0, 128), 1)
- cv2.imwrite('linesDetected.jpg', img)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement