mxpi_imageencoder

Function

Encodes images.

Synchronous/Asynchronous (Status)

Asynchronous

Constraints

  • Maximum resolution of the input image: 8192 x 8192
  • Minimum resolution of the input image: 32 x 32
  • The width and height of the input image must be even numbers. If they are odd numbers, they are automatically aligned to even numbers.
  • widthStride of the input image (width after alignment): For the YUV420SP or RGB data, round up widthStride to the nearest multiple of 16 or 128 (for better performance). For YUV422Packed data, round up twice the input width to the nearest multiple of 16.
  • heightStride of the input image (height after alignment): Retain the input height. Alternatively, round up the input height to the nearest multiple of 16 (at least 32),
  • Input image formats: YUV420SP (NV12 and NV21), YUV422Packed (YUYV, UYV, YVYU, and VYUY), and RGB (RGB888 and BGR888)
  • Input data type: Currently, only UINT8 is supported.
  • Output image format: JPEG, for example, *.jpg

Plugin Base Class (Factory)

mxpi_imageencoder

Input/Output

Input: buffer (data type: MxpiBuffer) and metadata (data type: MxpiVisionList, MxpiFrame, or MxpiVision)

Output: buffer (data type: MxpiBuffer)

Port Format (Caps)

Static input: {"ANY"}

Static output: {"ANY"}

Property

For details, see Table 1.

Table 1 mxpi_imageencoder plugin properties

Property Name

Description

Mandatory or Not

Modifiable or Not

deviceId

Ascend device ID, which is specified by the deviceId property in the stream_config field. You do not need to set the ID.

No

Yes

dataSource

Index of the input data (generally the name of the upstream element). The default value is the key value of the output port of the upstream plugin.

No

Yes

encodeLevel

Encoding level.

  • For Atlas 200/300/500 inference products, the default value is 0, and the value range is [0, 100].
  • For Atlas inference products, the default value is 100, and the value range is [1, 100].
NOTE:
  • For the value ranging from 1 to 100, a smaller value indicates poorer output image quality.
  • For Atlas 200/300/500 inference products, the default value 0 has the same effect as the value 100.

No

Yes