-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimg.py
More file actions
28 lines (27 loc) · 760 Bytes
/
img.py
File metadata and controls
28 lines (27 loc) · 760 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
import cv2
import os
import glob
from PIL import Image
from multiprocessing import Pool
pa="./videoplayback_Trim.mp4"
cam = cv2.VideoCapture(pa)
try:
if not os.path.exists('data'):
os.makedirs('data')
except OSError:
print ('Error: Creating directory of data')
currentframe = 0
while(True):
ret,frame = cam.read()
if ret:
name = './data/frame' + str(currentframe) + '.jpg'
print ('Creating...' + name)
cv2.imwrite(name, frame)
currentframe += 1
else:
break
cam.release()
cv2.destroyAllWindows()
print("10 frames fetching completed")
os.system('python img1.py')
print("croping executed")