Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import cv2
- img = cv2.imread("assets/frame5.jpg", 1)
- gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- edges = cv2.Canny(gray, 75, 150)
- lines = cv2.HoughLinesP(edges, 1, np.pi/180, 50, maxLineGap=10)
- for line in lines:
- x1, y1, x2, y2 = line[0]
- cv2.line(img, (x1, y1), (x2, y2), (0, 0, 255), 3)
- img = cv2.resize(img, (0, 0), fx=0.5, fy=0.5)
- cv2.imwrite("assets/frame5_scanned.jpg", img)
- # cv2.imshow("Edges", edges)
- cv2.waitKey(0)
- cv2.destroyAllWindows()
- # cap = cv.VideoCapture('assets/IMG_3477.mp4')
- #
- # while cap.isOpened():
- # ret, frame = cap.read()
- # if ret == True:
- # cv.imshow('frame', frame)
- # if cv.waitKey(1) & 0xFF == ord('q'):
- # break
- #
- # cap.release()
- # cv.destroyAllWindows()
Add Comment
Please, Sign In to add comment