forked from JunhaoGao/detect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsharp3.py
More file actions
42 lines (34 loc) · 967 Bytes
/
sharp3.py
File metadata and controls
42 lines (34 loc) · 967 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
35
36
37
38
39
40
41
42
# import cv2
# vc = cv2.VideoCapture('test.mp4')
# c = 1
# if vc.isOpened():
# rval, frame = vc.read()
# else:
# rval = False
# print rval
# timeF = 1000
# while rval:
# rval, frame = vc.read()
# if(c%timeF == 0):
# cv2.imwrite('image/'+str(c) + '.jpg',frame)
# c = c + 1
# cv2.waitKey(1)
# vc.release()
import cv2
wnd = 'OpenCV Video'
videoCapture = cv2.VideoCapture('D:/FFOutput/Thefirst/FILE0006.avi')
fps = videoCapture.get(cv2.cv.CV_CAP_PROP_FPS)
size = (int(videoCapture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)),
int(videoCapture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)))
cv2.namedWindow(wnd, flags=0)
cv2.resizeWindow(wnd, size[0] / 2, size[1] / 2)
success, frame = videoCapture.read()
c = 1
while success:
cv2.imshow(wnd, frame)
cv2.waitKey(1000 / int(fps))
if (c % 1000 == 0):
cv2.imwrite('image/' + str(c) + '.jpg', frame)
success, frame = videoCapture.read()
c = c + 1
cv2.waitKey(0)