Shortcuts

SunglassesEffectNode

class mmpose.apis.webcam.nodes.SunglassesEffectNode(name: str, input_buffer: str, output_buffer: Union[str, List[str]], enable_key: Optional[Union[str, int]] = None, enable: bool = True, kpt_thr: float = 0.5, resource_img_path: Optional[str] = None)[source]

Apply sunglasses effect (draw sunglasses at the facial area)to the objects with eye keypoints in the frame.

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-key has been use for particular use. For example:

      ’q’, ‘Q’ and 27 are used for quit

    Default: None

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

  • kpt_thr (float) – The score threshold of valid keypoints. Default: 0.5

  • resource_img_path (str, optional) – The resource image path or url. The image should be a pair of sunglasses with white background. If not specified, the url of a default image will be used. See SunglassesNode.default_resource_img_path. Default: None

Example::
>>> cfg = dict(
...    type='SunglassesEffectNode',
...    name='sunglasses',
...    enable_key='s',
...    enable=False,
...    input_buffer='vis',
...    output_buffer='vis_sunglasses')
>>> from mmpose.apis.webcam.nodes import NODES
>>> node = NODES.build(cfg)
apply_sunglasses_effect(canvas: numpy.ndarray, objects: List[Dict], left_eye_index: int, right_eye_index: int)numpy.ndarray[source]

Apply sunglasses effect.

Parameters
  • canvas (np.ndarray) – The image to apply the effect

  • objects (list[dict]) – The object list with keypoints - “keypoints” ([K,3]): keypoints in [x, y, score]

  • left_eye_index (int) – Keypoint index of the left eye

  • right_eye_index (int) – Keypoint index of the right eye

Returns

Processed image

Return type

np.ndarray

draw(input_msg)[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: v0.28.0
Versions
latest
v0.28.0
v0.27.0
v0.26.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.