Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3.  
  4. img = cv2.imread('.image.jpg')
  5.  
  6. gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
  7. edges = cv2.Canny(gray, 500, 460)
  8. lines = cv2.HoughLinesP(edges, 1, np.pi/180, 30, maxLineGap=250)
  9. for line in lines:
  10. x1, y1, x2, y2 = line[0]
  11. cv2.line(img, (x1, y1), (x2, y2), (0, 0, 128), 1)
  12.  
  13. cv2.imwrite('linesDetected.jpg', img)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement