This notebook is a function for getting image from video.notebook below have two part: function part and example part.
def gdown_unzip(id, filename):
"""download a zipfile and unzip it under data directory
"""
dataset_url = 'https://drive.google.com/u/1/uc?id=' + id
dataset_name = filename
if not os.path.isdir(dataset_name):
gdown.download(dataset_url, output = dataset_name + '.zip', quiet=False)
zip_file = ZipFile( dataset_name + '.zip')
#zip_file.extractall()
zip_file.extractall() # depends on how to zip it
zip_file.close()
cd data
id = '1YVXSOUB9sb1hCD64oLZtTJrSIdZqTetQ'
filename = 'wamv_5_16'
gdown_unzip(id, filename)
print("\n Finished downloading.")
mkdir output
time_F = 500
video_name = 'wamv_5_16.mp4'
video_images = get_images_from_video(video_name, time_F)
for i in range(0, len(video_images)):
cv2.imwrite('/home/arg/arg_robotics_tools/data/output/%dout.jpg'%i,video_images[i])
print("\n Finished.")