Shortcuts

BaseVisualizerNode

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

Base class for nodes whose function is to create visual effects, like visualizing model predictions, showing graphics or showing text messages.

All subclass should implement the method draw().

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

bypass(input_msgs: Dict[str, mmpose.apis.webcam.utils.message.Message])Optional[mmpose.apis.webcam.utils.message.Message][source]

The method that defines the node behavior when disabled.

Note that a node must override this method if it has enable_key. This method has the same signature as process().

Parameters

input_msgs (dict[str, Message]) – The input data collected from the buffers. For each item, the key is the input_name of the registered input buffer, and the value is a Message instance fetched from the buffer (or None if the buffer is non-trigger and not ready).

Returns

The output message of the node which will be send to all registered output buffers.

Return type

Message

abstract 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

process(input_msgs: Dict[str, mmpose.apis.webcam.utils.message.Message])Optional[mmpose.apis.webcam.utils.message.Message][source]

The method that implements the function of the node.

This method will be invoked when the node is enabled and the input data is ready. All subclasses of Node should override this method.

Parameters

input_msgs (dict[str, Message]) – The input data collected from the buffers. For each item, the key is the input_name of the registered input buffer, and the value is a Message instance fetched from the buffer (or None if the buffer is non-trigger and not ready).

Returns

The output message of the node which will be send to all registered output buffers.

Return type

Message

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

Free document hosting provided by Read the Docs.