NoticeBoardNode¶
- class mmpose.apis.webcam.nodes.NoticeBoardNode(name: str, input_buffer: str, output_buffer: Union[str, List[str]], enable_key: Optional[Union[str, int]] = None, enable: bool = True, content_lines: Optional[List[str]] = None, x_offset: int = 20, y_offset: int = 20, y_delta: int = 15, text_color: Union[str, Tuple[int, int, int]] = 'black', background_color: Union[str, Tuple[int, int, int]] = (255, 183, 0), text_scale: float = 0.4)[source]¶
Show text messages 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, thebypass()
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
content_lines (list[str], optional) – The lines of text message to show in the frame. If not given, a default message will be shown. Default:
None
x_offset (int) – The position of the notice board’s left border in pixels. Default: 20
y_offset (int) – The position of the notice board’s top border in pixels. Default: 20
y_delta (int) – The line height in pixels. Default: 15
text_color (str|tuple) – The font color represented in a color name or a BGR tuple. Default:
'black'
backbround_color (str|tuple) – The background color represented in a color name or a BGR tuple. Default: (255, 183, 0)
text_scale (float) – The font scale factor that is multiplied by the base size. Default: 0.4
- Example::
>>> cfg = dict( ... type='NoticeBoardNode', ... name='instruction', ... enable_key='h', ... enable=True, ... input_buffer='vis_bigeye', ... output_buffer='vis_notice', ... content_lines=[ ... 'This is a demo for pose visualization and simple image ' ... 'effects. Have fun!', '', 'Hot-keys:', ... '"v": Pose estimation result visualization', ... '"s": Sunglasses effect B-)', '"b": Big-eye effect 0_0', ... '"h": Show help information', ... '"m": Show diagnostic information', '"q": Exit' ... ], ... )
>>> 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