Shortcuts

ObjectVisualizerNode

class mmpose.apis.webcam.nodes.ObjectVisualizerNode(name: str, input_buffer: str, output_buffer: Union[str, List[str]], enable_key: Optional[Union[str, int]] = None, enable: bool = True, show_bbox: bool = True, show_keypoint: bool = True, must_have_keypoint: bool = False, kpt_thr: float = 0.3, radius: int = 4, thickness: int = 2, bbox_color: Optional[Union[str, Tuple, Dict]] = None)[source]

Visualize the bounding box and keypoints of objects.

Parameters
  • name (str) – The node name (also thread name)

  • input_buffer (str) – The name of the input buffer

  • output_buffer (str|list) – The name(s) of the output buffer(s)

  • enable_key (str|int, optional) – Set a hot-key to toggle enable/disable of the node. If an int value is given, it will be treated as an ascii code of a key. Please note: (1) If enable_key is set, the bypass() method need to be overridden to define the node behavior when disabled; (2) Some hot-keys are reserved for particular use. For example: ‘q’, ‘Q’ and 27 are used for exiting. Default: None

  • enable (bool) – Default enable/disable status. Default: True

  • show_bbox (bool) – Set True to show the bboxes of detection objects. Default: True

  • show_keypoint (bool) – Set True to show the pose estimation results. Default: True

  • must_have_bbox (bool) – Only show objects with keypoints. Default: False

  • kpt_thr (float) – The threshold of keypoint score. Default: 0.3

  • radius (int) – The radius of keypoint. Default: 4

  • thickness (int) – The thickness of skeleton. Default: 2

  • bbox_color (str|tuple|dict) – The color of bboxes. If a single color is given (a str like ‘green’ or a BGR tuple like (0, 255, 0)), it will be used for all bboxes. If a dict is given, it will be used as a map from class labels to bbox colors. If not given, a default color map will be used. Default: None

Example::
>>> cfg = dict(
...    type='ObjectVisualizerNode',
...    name='object visualizer',
...    enable_key='v',
...    enable=True,
...    show_bbox=True,
...    must_have_keypoint=False,
...    show_keypoint=True,
...    input_buffer='frame',
...    output_buffer='vis')
>>> from mmpose.apis.webcam.nodes import NODES
>>> node = NODES.build(cfg)
draw(input_msg: mmpose.apis.webcam.utils.message.FrameMessage)numpy.ndarray[source]

Draw on the frame image of the input FrameMessage.

Parameters

input_msg (FrameMessage) – The message of the frame to draw on

Returns

The processed image.

Return type

np.array

Read the Docs v: latest
Versions
latest
1.x
v1.0.0rc0
v0.29.0
v0.28.0
v0.27.0
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.