1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| # -*- coding: utf-8 -*-
| __author__ = '上海色宁'
|
| import datetime
| import cv2
| from _image_clip_setting import image_clip
|
| time_now = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
| #cap = cv2.VideoCapture(0)
| cap = cv2.VideoCapture("new.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[image_clip[0]:image_clip[1], image_clip[2]:image_clip[3]])
| cap.release()
| cv2.destroyAllWindows()
|
|