Commit a4c3ff07 authored by qjin's avatar qjin
Browse files

Upload New File

parent e60440f8
import cv2
import glob
for v in glob.iglob("video/*.mp4"):
vidcap = cv2.VideoCapture(v)
print("Processing" + v)
success, image = vidcap.read()
vid_num = 1
count = 0
print("This video is labeled as No." + str(vid_num))
while success:
image = image[50:500, 170:750] # crop
cv2.imwrite("video_frames/video_" + str(vid_num) + "_frame_" + str(count) + ".png", image) # save frame as JPEG file
success,image = vidcap.read()
count += 1
vid_num += 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment