human/utils.py

36 lines
707 B
Python
Raw Normal View History

2024-09-12 00:15:09 +00:00
#encoding = utf8
import os
2024-10-04 06:37:50 +00:00
import cv2
from tqdm import tqdm
2024-09-12 00:15:09 +00:00
def read_files_path(path):
file_paths = []
files = os.listdir(path)
for file in files:
if not os.path.isdir(file):
file_paths.append(path + file)
return file_paths
2024-10-03 17:52:49 +00:00
2024-10-04 06:37:50 +00:00
def read_images(img_list):
frames = []
print('reading images...')
for img_path in tqdm(img_list):
print(f'read image path:{img_path}')
frame = cv2.imread(img_path)
frames.append(frame)
return frames
2024-10-03 17:52:49 +00:00
def mirror_index(size, index):
# size = len(self.coord_list_cycle)
turn = index // size
res = index % size
if turn % 2 == 0:
return res
else:
return size - res - 1