xxxxxxxxxx
import cv2
cap = cv2.videoCapture(0)
#check if the webcam ic opened correctly
if not cap.isopened():
raise IOError("Cannot open webcam")
while true:
ret, frame = cap.read()
frame = cv2.resize(frame, None, fx=0.5, fy=0.5, interpolation=cv2.INTER_AREA)
cv2.imshow('input',frame)
c = cv2.waitKey(1)
if c ==27:
cap.release()
cv2..destroyAllWindows()
xxxxxxxxxx
#made a mistake @BloodyBeaver line 9
import cv2
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
cv2.imshow('webcam feed' , frame)
if cv2.waitKey(1) and 0xFF == ord(' '):
break
cap.release()
cv2.destroyAllWindows()
#by using the spacebar you will be able to finish the process of video capturing
#in opencv and the window will closeeeeee