Advertisement
BlackDT

Untitled

Apr 16th, 2020
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. import cv2
  2. import numpy
  3.  
  4. image_colour = cv2.imread('/Users/dariabusi/Desktop/6_2.png',cv2.IMREAD_COLOR)
  5. cv2.imshow ('Original', image_colour)
  6. image_grey = cv2.imread('/Users/dariabusi/Desktop/6_2.png',cv2.IMREAD_GRAYSCALE)
  7.  
  8. new_threshold, image_thresh = cv2.threshold(image_grey, 125, 255 , cv2.THRESH_BINARY_INV)
  9. cv2.imshow ('Originalcanny', image_thresh)
  10.  
  11. linesP = cv2.HoughLinesP( image = image_thresh, rho = 1, theta = numpy.pi/100 , threshold = 255, maxLineGap = 15)
  12.  
  13. for i in range(0, len(linesP)):
  14.             l = linesP[i][0]
  15.             cv2.line(image_colour, (l[0], l[1]), (l[2], l[3]), (255,255,255), 5, cv2.LINE_AA)
  16.  
  17. cv2.imshow ('Experiment3', image_colour)
  18.  
  19.  
  20.  
  21. cv2.waitKey(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement