代码如下:
import numpy as np
import cv2
cap = cv2.VideoCapture('output_2.avi')
ret, frame = cap.read() # take first frame of the video
print(frame.shape)
# setup initial location of window
r, h, c, w = 200, 170, 260, 100 # simply hardcoded the values
track_window = (c, r, w, h)
cv2.rectangle(frame, (c, r), (c + w, r + h), 2