1 | initial version |
You having typo comma cv2, rectangle
. Your code doesn't do anything cv2.waitKey
.
import cv2
cap = cv2.VideoCapture(0)
cap.set(3,640)
cap.set(4,380)
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
cut = cv2.rectangle(frame, (220, 200), (450, 400), (255,0,0), 2)
cv2.imshow('cut', cut)
key = cv2.waitKey(10)
if key == 27 or key == 113:
break
cap.release()
cv2.destroyAllWindows()