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

Function visualize_kp3d

detrsmpl/core/visualization/visualize_keypoints3d.py:42–218  ·  view source on GitHub ↗

Visualize 3d keypoints to a video with matplotlib. Support multi person and specified limb connections. Args: kp3d (np.ndarray): shape could be (f * J * 4/3/2) or (f * num_person * J * 4/3/2) output_path (str): output video path image folder. limbs (Optio

(
    kp3d: np.ndarray,
    output_path: Optional[str] = None,
    limbs: Optional[Union[np.ndarray, List[int]]] = None,
    palette: Optional[Iterable[int]] = None,
    data_source: str = 'coco',
    mask: Optional[Union[list, tuple, np.ndarray]] = None,
    start: int = 0,
    end: Optional[int] = None,
    resolution: Union[list, Tuple[int, int]] = (1024, 1024),
    fps: Union[float, int] = 30,
    frame_names: Optional[Union[List[str], str]] = None,
    orbit_speed: Union[float, int] = 0.5,
    value_range: Union[Tuple[int, int], list] = (-100, 100),
    pop_parts: Iterable[str] = (),
    disable_limbs: bool = False,
    return_array: Optional[bool] = None,
    convention: str = 'opencv',
    keypoints_factory: dict = keypoints_mapping.KEYPOINTS_FACTORY,
)

Source from the content-addressed store, hash-verified

40
41
42def visualize_kp3d(
43 kp3d: np.ndarray,
44 output_path: Optional[str] = None,
45 limbs: Optional[Union[np.ndarray, List[int]]] = None,
46 palette: Optional[Iterable[int]] = None,
47 data_source: str = 'coco',
48 mask: Optional[Union[list, tuple, np.ndarray]] = None,
49 start: int = 0,
50 end: Optional[int] = None,
51 resolution: Union[list, Tuple[int, int]] = (1024, 1024),
52 fps: Union[float, int] = 30,
53 frame_names: Optional[Union[List[str], str]] = None,
54 orbit_speed: Union[float, int] = 0.5,
55 value_range: Union[Tuple[int, int], list] = (-100, 100),
56 pop_parts: Iterable[str] = (),
57 disable_limbs: bool = False,
58 return_array: Optional[bool] = None,
59 convention: str = 'opencv',
60 keypoints_factory: dict = keypoints_mapping.KEYPOINTS_FACTORY,
61) -> Union[None, np.ndarray]:
62 """Visualize 3d keypoints to a video with matplotlib. Support multi person
63 and specified limb connections.
64
65 Args:
66 kp3d (np.ndarray): shape could be (f * J * 4/3/2) or
67 (f * num_person * J * 4/3/2)
68 output_path (str): output video path image folder.
69 limbs (Optional[Union[np.ndarray, List[int]]], optional):
70 if not specified, the limbs will be searched by search_limbs,
71 this option is for free skeletons like BVH file.
72 Defaults to None.
73 palette (Iterable, optional): specified palette, three int represents
74 (B, G, R). Should be tuple or list.
75 Defaults to None.
76 data_source (str, optional): data source type. Defaults to 'coco'.
77 choose in ['coco', 'smplx', 'smpl', 'coco_wholebody',
78 'mpi_inf_3dhp', 'mpi_inf_3dhp_test', 'h36m', 'pw3d', 'mpii']
79 mask (Optional[Union[list, tuple, np.ndarray]], optional):
80 mask to mask out the incorrect points. Defaults to None.
81 start (int, optional): start frame index. Defaults to 0.
82 end (int, optional): end frame index.
83 Could be positive int or negative int or None.
84 None represents include all the frames.
85 Defaults to None.
86 resolution (Union[list, Tuple[int, int]], optional):
87 (width, height) of the output video
88 will be the same size as the original images if not specified.
89 Defaults to None.
90 fps (Union[float, int], optional): fps. Defaults to 30.
91 frame_names (Optional[Union[List[str], str]], optional): List(should be
92 the same as frame numbers) or single string or string format
93 (like 'frame%06d')for frame title, no title if None.
94 Defaults to None.
95 orbit_speed (Union[float, int], optional): orbit speed of camera.
96 Defaults to 0.5.
97 value_range (Union[Tuple[int, int], list], optional):
98 range of axis value. Defaults to (-100, 100).
99 pop_parts (Iterable[str], optional): The body part names you do not

Callers

nothing calls this directly

Calls 11

set_connectionsMethod · 0.95
render_kp3d_to_videoMethod · 0.95
prepare_output_pathFunction · 0.90
get_different_colorsFunction · 0.90
search_limbsFunction · 0.90
_norm_poseFunction · 0.85
copyMethod · 0.80
concatenateMethod · 0.80
init_cameraMethod · 0.80
keysMethod · 0.45

Tested by

no test coverage detected