You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
657 B
Python
26 lines
657 B
Python
2 years ago
|
import cv2
|
||
|
import os
|
||
|
|
||
|
def get_dir_file(path,ext_list):
|
||
|
# video_ext = [".mp4", ".avi", ".MP4"]
|
||
|
file_names = []
|
||
|
for maindir, subdir, file_name_list in os.walk(path):
|
||
|
for filename in file_name_list:
|
||
|
apath = os.path.join(maindir, filename)
|
||
|
ext = os.path.splitext(apath)[1]
|
||
|
if ext in ext_list:
|
||
|
file_names.append(apath)
|
||
|
return file_names
|
||
|
|
||
|
def get_imgframe(img_path_list):
|
||
|
|
||
|
imgframe_list = []
|
||
|
for img in img_path_list:
|
||
|
|
||
|
images = cv2.imread(img)
|
||
|
imgframe_dict = {"path":img,'frame':images}
|
||
|
imgframe_list.append(imgframe_dict)
|
||
|
|
||
|
return imgframe_list
|
||
|
|