mxpi_imagedecoder

Function

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

NOTE:
Restrictions on the JPG and JPEG input image format:
  • 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 JPEG 2000 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 (width after alignment) of the output image: The decoding plugin automatically aligns when the width of an Atlas 200/300/500 inference product is a multiple of 128 and that of Atlas inference products is a multiple of 64.
  • heightStride (height after alignment) of the output image: 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) and 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

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

imageFormat

Format of the image to be decoded. The default format is JPG. The Ascend mode supports JPEG, JPG, and BMP, while the OpenCV mode supports JPG, JPEG, BMP, and other formats.

Yes

Yes

cvProcessor

Processing mode. For details about the differences, see Before You Start.
  • Ascend (default)
  • OpenCV

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 products. The resolution of the input image must range from 32 x 32 to 4096 x 4096.)

No

Yes