-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcutintopictures.py
More file actions
34 lines (23 loc) · 783 Bytes
/
Copy pathcutintopictures.py
File metadata and controls
34 lines (23 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import cv2
START_TIME = 1
END_TIIME = 28800
vidcap = cv2.VideoCapture("C:\\Users\\DELL\\Desktop\\narun.avi")
fps = int(vidcap.get(cv2.CAP_PROP_FPS))
print(fps)
frameToStart = START_TIME*fps
print(frameToStart)
frameToStop = END_TIIME*fps
print(frameToStop)
vidcap.set(cv2.CAP_PROP_POS_FRAMES, frameToStart)
print(vidcap.get(cv2.CAP_PROP_POS_FRAMES))
success, image = vidcap.read()
count = 0
while success and frameToStop >= count:
if count % 1 == 0:
cv2.imwrite("C:\\Users\\DELL\\Desktop\\action0\\image_%d.png" %
(count // 1), image)
print('Process %dtypeerror: not all arguments converted during string formattingth seconds:' % int(
count / 1), success)
success, image = vidcap.read()
count += 1
print("end!")