def process_image_folder(self, folder_path, min_score_threshold, output_path, save_images):
    folder_name = Path(folder_path).stem
    frames = []
    file_names = os.listdir(folder_path)
    file_names.sort()
    for f in file_names:
        image_path = os.path.join(folder_path, f)
        if os.path.isfile(image_path):
            frame_number = len(frames)
            next_frame = self.process_image(folder_name, frame_number, image_path, min_score_threshold, output_path, save_images)
            frames.append(next_frame)
    if save_images:
        video_path = os.path.join(output_path, folder_name)
        video = cv2.VideoCapture(video_path)
        print('Saving video at', video_path)
        images_to_video(frames, video_path, 30)
def process_image_folder(self, folder_path, min_score_threshold, output_path, save_images):
    folder_name = Path(folder_path).stem
    frames = []
    file_names = os.listdir(folder_path)
    file_names.sort()
    for f in file_names:
        image_path = os.path.join(folder_path, f)
        if os.path.isfile(image_path):
            frame_number = len(frames)
            next_frame = self.process_image(folder_name, frame_number, image_path, min_score_threshold, output_path, save_images)
            frames.append(next_frame)
    if save_images:
        video_path = os.path.join(output_path, folder_name)
        video = cv2.VideoCapture(video_path)
        print('Saving video at', video_path)
        images_to_video(frames, video_path, 30)