opencv python基本操作
Python usage
crop frame:
croppedframe = frame[ymin:ymax, xmin:xmax]
resize frame:
reszframe = cv2.resize(frame, (size, size))
read video:
初始化
vid = cv2.VideoCapture(videoname)
读取方式:
vid.set(read_mode, num or second)
numoframes = vid.get(cv2.CAP_PROP_FRAME_COUNT)
ret, frame = vid.read()
read_mode:
cv2.CV_CAP_RPOP_POS_MSEC: 按秒
cv2.CV_CAP_PROP_POSE_FRAMES: 按帧数,从0开始