14 lines
373 B
Python
14 lines
373 B
Python
import cv2
|
|
|
|
cap = cv2.VideoCapture(2)
|
|
|
|
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
|
|
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
|
|
|
|
while True:
|
|
_, frame = cap.read()
|
|
grey = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
|
|
_, thresh = cv2.threshold(grey, 127, 255, cv2.THRESH_BINARY)
|
|
cv2.imshow('original', frame)
|
|
cv2.imshow('thresh', thresh)
|
|
cv2.waitKey(1)
|