-
Notifications
You must be signed in to change notification settings - Fork 5
/
create_moves.py
30 lines (23 loc) · 763 Bytes
/
create_moves.py
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
import cv2
def create_move(video_name):
cap = cv2.VideoCapture(0)
# Get the Default resolutions
frame_width = int(cap.get(3))
frame_height = int(cap.get(4))
fps = 24
# Define the codec and filename.
out = cv2.VideoWriter('dance_videos/{}.mp4'.format(video_name), cv2.VideoWriter_fourcc('M','J','P','G'), fps, (frame_width,frame_height))
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
# write the frame
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()