wangzhibo
2022-03-14 5a4e2f4942edc1b86e79d82af6b658165dfb7220
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# -*- coding: utf-8 -*-
__author__ = '上海色宁'
 
import datetime
import cv2
 
time_now = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
#cap = cv2.VideoCapture(0)
cap = cv2.VideoCapture("video.mp4")
ret, frame = cap.read()
cv2.imwrite(time_now+".jpg", frame)
print('手动设置 唯一的参数: 数字仪表盘的位置: 要稍微留些余量。')
print('格式为图像区域 [Y轴 min:max, X轴 min:max],如[176:234,280:426]')
print('另外图形 左上角为0,0 向右 为X轴正向,向下为Y轴正向')
cv2.imwrite(time_now+"_clip.jpg",frame[176:234,280:426])
cap.release()
cv2.destroyAllWindows()