Update frame list if have origin_frames.
(frame_list, origin_frames, img_format, start, end)
| 369 | |
| 370 | |
| 371 | def update_frame_list(frame_list, origin_frames, img_format, start, end): |
| 372 | """Update frame list if have origin_frames.""" |
| 373 | input_temp_folder = None |
| 374 | # choose in frame_list or origin_frames |
| 375 | if frame_list is None and origin_frames is None: |
| 376 | print('No background provided, will use pure white background.') |
| 377 | elif frame_list is not None and origin_frames is not None: |
| 378 | warnings.warn('Redundant input, will only use frame_list.') |
| 379 | origin_frames = None |
| 380 | if origin_frames is not None: |
| 381 | check_input_path(input_path=origin_frames, |
| 382 | allowed_suffix=['.mp4', '.gif', ''], |
| 383 | tag='origin frames', |
| 384 | path_type='auto') |
| 385 | if Path(origin_frames).is_file(): |
| 386 | input_temp_folder = origin_frames + '_temp_images/' |
| 387 | video_to_images(origin_frames, |
| 388 | input_temp_folder, |
| 389 | start=start, |
| 390 | end=end) |
| 391 | frame_list = glob.glob(osp.join(input_temp_folder, '*.png')) |
| 392 | frame_list.sort() |
| 393 | else: |
| 394 | if img_format is None: |
| 395 | frame_list = [] |
| 396 | for im_name in os.listdir(origin_frames): |
| 397 | if Path(im_name).suffix.lower() in [ |
| 398 | '.png', '.jpg', '.jpeg' |
| 399 | ]: |
| 400 | frame_list.append(osp.join(origin_frames, im_name)) |
| 401 | else: |
| 402 | frame_list = [] |
| 403 | for index in range(start, end): |
| 404 | frame_path = osp.join(origin_frames, img_format % index) |
| 405 | if osp.exists(frame_path): |
| 406 | frame_list.append(frame_path) |
| 407 | frame_list.sort() |
| 408 | return frame_list, input_temp_folder |
| 409 | |
| 410 | |
| 411 | def visualize_kp2d( |
no test coverage detected