import cv2
w, h = 200, 200
vid = cv2.VideoCapture(0)
while True:
ret, frame = vid.read()
frame[frame[..., 0] > 150] = [255, 255, 255]
frame[frame[..., 0] <= 150] = [0, 0, 0]
cv2.imshow('frame.jpg', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
vid.release()
cv2.destroyAllWindows()