forked from jhinericusername/TheraView
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFramify.py
More file actions
29 lines (23 loc) · 676 Bytes
/
Framify.py
File metadata and controls
29 lines (23 loc) · 676 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
import cv2
# read the video file
cap = cv2.VideoCapture('jj.mp4')
# initialize an empty list to store frames
frames = []
# loop through all the frames in the video
while (cap.isOpened()):
# read a frame from the video
ret, frame = cap.read()
# if the frame is read correctly
if ret == True:
# append the frame to the list of frames
frames.append(frame)
else:
break
# release the video capture object
cap.release()
# print the number of frames extracted
print('Extracted', len(frames), 'frames from the video')
# display the first frame as an example
cv2.imshow('First Frame', frames[0])
cv2.waitKey(0)
cv2.destroyAllWindows()