mxpi_imagedecoder

Function

Decodes images. Currently, only the JPG, JPEG, and BMP formats are supported.

Restrictions on the JPG and JPEG input images:
  • Only Huffman coding is supported. The subsample of the stream is 444, 422, 420, 400, or 440.
  • Arithmetic coding is not supported.
  • The progressive JPEG format is not supported.
  • The JPEG2000 format is not supported.

Synchronous/Asynchronous (Status)

Asynchronous

Constraints

  • Maximum resolution of the JPG/JPEG input image: 8192 x 8192
  • Minimum resolution of the JPG/JPEG input image: 32 x 32
  • There is no resolution restriction on BMP input images or in the OpenCV mode.
  • widthStride of the output image after alignment:
    • Atlas 200/300/500 inference product: The decoding plugin automatically rounds up the input width to the nearest multiple of 128.
    • Atlas 200I/500 A2 inference product: The decoding plugin automatically rounds up the input width to the nearest multiple of 128.
    • Atlas inference product: The decoding plugin automatically rounds up the input width to the nearest multiple of 64.
  • heightStride of the output image after alignment: The decoding plugin automatically rounds up the input height to the nearest multiple of 16.

Plugin Base Class (Factory)

mxpi_imagedecoder

Input/Output

  • Input: buffer (data type: MxpiBuffer)
  • Output: buffer (data type: MxpiBuffer), metadata (data type: MxpiVisionList and MxpiObjectList)

Port Format (Caps)

  • Static input: {"image/jpeg"}
  • Dynamic output: {"image/yuv","metadata/object","image/rgb"}

Property

For details, see Table 1.

Table 1 mxpi_imagedecoder plugin properties

Property Name

Description

Mandatory or Not

Modifiable or Not

deviceId

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

No

Yes

imageFormat

Format of the image to be decoded. The default format is JPG.

  • The Ascend mode supports JPEG, JPG, and BMP.
  • The OpenCV mode supports JPG, JPEG, BMP, and other formats.

Yes

Yes

cvProcessor

Processing method:
  • ascend (default): Ascend DVPP interfaces are called for processing.
  • opencv: OpenCV interfaces are called for processing.

No

Yes

outputDataFormat

When the OpenCV mode is used and the input image format is bmp, the output image data type can only be BGR or RGB.

  • When the OpenCV mode is used for decoding, BGR data is output by default after image decoding. You can change the output data to RGB data by using this property.
  • For BMP images, they are output as BGR data. You can change the output data to RGB data by using this property.
  • When the Ascend mode is used for decoding, JPEG and JPG images are decoded and output as YUV data. In this case, this property cannot be configured.

No

Yes

dataType

Type of the decoded data. The default value is uint8. It can also be set to float32, which is valid for the OpenCV processing method.

No

Yes

formatAdaptation

CSC function, which decodes images into BGR888 format. The value is a string. The default value is off. Set this parameter to on when enabling the CSC function. (Currently, this function is supported only on the Atlas inference product. The resolution of the input image must range from 32 x 32 to 4096 x 4096.)

No

Yes

handleMethod

Reserved property. Use cvProcessor.

Processing method:

  • ascend (default)
  • opencv

No

Yes