MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / visualize_kp2d

Function visualize_kp2d

detrsmpl/core/visualization/visualize_keypoints2d.py:411–610  ·  view source on GitHub ↗

Visualize 2d keypoints to a video or into a folder of frames. Args: kp2d (np.ndarray): should be array of shape (f * J * 2) or (f * n * J * 2)] output_path (str): output video path or image folder. frame_list (Optional[List[str]], optional

(
    kp2d: np.ndarray,
    output_path: Optional[str] = None,
    frame_list: Optional[List[str]] = None,
    origin_frames: Optional[str] = None,
    image_array: Optional[np.ndarray] = None,
    limbs: Optional[Union[np.ndarray, List[int]]] = None,
    palette: Optional[Iterable[int]] = None,
    data_source: str = 'coco',
    mask: Optional[Union[list, np.ndarray]] = None,
    img_format: str = '%06d.png',
    start: int = 0,
    end: int = -1,
    overwrite: bool = False,
    with_file_name: bool = True,
    resolution: Optional[Union[Tuple[int, int], list]] = None,
    fps: Union[float, int] = 30,
    draw_bbox: bool = False,
    with_number: bool = False,
    pop_parts: Iterable[str] = None,
    disable_tqdm: bool = False,
    disable_limbs: bool = False,
    return_array: Optional[bool] = False,
    keypoints_factory: dict = KEYPOINTS_FACTORY,
    remove_raw_file: bool = True,
)

Source from the content-addressed store, hash-verified

409
410
411def visualize_kp2d(
412 kp2d: np.ndarray,
413 output_path: Optional[str] = None,
414 frame_list: Optional[List[str]] = None,
415 origin_frames: Optional[str] = None,
416 image_array: Optional[np.ndarray] = None,
417 limbs: Optional[Union[np.ndarray, List[int]]] = None,
418 palette: Optional[Iterable[int]] = None,
419 data_source: str = 'coco',
420 mask: Optional[Union[list, np.ndarray]] = None,
421 img_format: str = '%06d.png',
422 start: int = 0,
423 end: int = -1,
424 overwrite: bool = False,
425 with_file_name: bool = True,
426 resolution: Optional[Union[Tuple[int, int], list]] = None,
427 fps: Union[float, int] = 30,
428 draw_bbox: bool = False,
429 with_number: bool = False,
430 pop_parts: Iterable[str] = None,
431 disable_tqdm: bool = False,
432 disable_limbs: bool = False,
433 return_array: Optional[bool] = False,
434 keypoints_factory: dict = KEYPOINTS_FACTORY,
435 remove_raw_file: bool = True,
436) -> Union[None, np.ndarray]:
437 """Visualize 2d keypoints to a video or into a folder of frames.
438
439 Args:
440 kp2d (np.ndarray): should be array of shape (f * J * 2)
441 or (f * n * J * 2)]
442 output_path (str): output video path or image folder.
443 frame_list (Optional[List[str]], optional): list of origin background
444 frame paths, element in list each should be a image path like
445 `*.jpg` or `*.png`. Higher priority than `origin_frames`.
446 Use this when your file names is hard to sort or you only want to
447 render a small number frames.
448 Defaults to None.
449 origin_frames (Optional[str], optional): origin background frame path,
450 could be `.mp4`, `.gif`(will be sliced into a folder) or an image
451 folder. Lower priority than `frame_list`.
452 Defaults to None.
453 limbs (Optional[Union[np.ndarray, List[int]]], optional):
454 if not specified, the limbs will be searched by search_limbs,
455 this option is for free skeletons like BVH file.
456 Defaults to None.
457 palette (Iterable, optional): specified palette, three int represents
458 (B, G, R). Should be tuple or list.
459 Defaults to None.
460 data_source (str, optional): data source type. Defaults to 'coco'.
461 mask (Optional[Union[list, np.ndarray]], optional):
462 mask to mask out the incorrect point.
463 Pass a `np.ndarray` of shape (J,) or `list` of length J.
464 Defaults to None.
465 img_format (str, optional): input image format. Default to '%06d.png',
466 start (int, optional): start frame index. Defaults to 0.
467 end (int, optional): end frame index. Defaults to -1.
468 overwrite (bool, optional): whether replace the origin frames.

Callers

nothing calls this directly

Calls 12

get_different_colorsFunction · 0.90
check_path_suffixFunction · 0.90
images_to_videoFunction · 0.90
update_frame_listFunction · 0.85
_prepare_output_pathFunction · 0.85
_check_temp_pathFunction · 0.85
_prepare_limb_paletteFunction · 0.85
_CavasProducerClass · 0.85
_plot_kp2d_frameFunction · 0.85
copyMethod · 0.80
concatenateMethod · 0.80
keysMethod · 0.45

Tested by

no test coverage detected