Ask Your Question
0

How to cover up a piece of video

asked 2020-02-24 11:58:21 -0500

Mialek gravatar image

updated 2020-02-24 12:11:14 -0500

hello

how to hide the rest in white leave a blue rectangle

import cv2

cap = cv2.VideoCapture(0)

cap.set(3,640)
cap.set(4,380)

while(1):
    ret, frame = cap.read()
    if not ret:
        break

    cut = cv2,rectangle(frame, (220, 200), (450, 400), (255,0,0), 2)
    cv2.imshow('cut', cut)

    if cv2.waitKey(1) & 0xFF ==ord('q')

        break
cap.release()
cv2.destroyAllWindows()
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-02-24 22:19:03 -0500

supra56 gravatar image

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()
edit flag offensive delete link more

Comments

how to hide the rest in white leave???????? What is that?

supra56 gravatar imagesupra56 ( 2020-02-24 22:22:43 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-02-24 11:58:21 -0500

Seen: 28 times

Last updated: Feb 24