Welcome to our Support Center

ImageDecoder

Description

Loads and decodes and image from a file. If it can’t decode for any reason (e.g. corrupted encoded stream, invalid format, it will return an empty matrix).

 

 

The following image formats are supported :

    • BMP
    • JPEG (note: Lossless JPEG support is optional)
    • JPEG2000
    • TIFF
    • PNG
    • WebP
    • Portable image format (PBM, PGM, PPM, PXM, PNM) Decoded images follow a channel-last layout: (Height, Width, Channels). JPEG chroma upsampling method: When upsampling the chroma components by a factor of 2, the pixels are linearly interpolated so that the centers of the output pixels are 1/4 and 3/4 of the way between input pixel centers. When rounding, 0.5 is rounded down and up at alternative pixels locations to prevent bias towards larger values (ordered dither pattern). Considering adjacent input pixels A, B, and C, B is upsampled to pixels B0 and B1 so that : 
      B0 = round_half_down((1/4) * A + (3/4) * B)
      B1 = round_half_up((3/4) * B + (1/4) * C)
      
      

      This method, is the default chroma upsampling method in the well-established libjpeg-turbo library, also referred as “smooth” or “fancy” upsampling.

 

Input parameters

 

specified_outputs_namearray, this parameter lets you manually assign custom names to the output tensors of a node.
encoded_stream (heterogeneous) – T1 : object, encoded stream.

 Parameters : cluster,

pixel_format : enum, pixel format. Can be one of “RGB”, “BGR”, or “Grayscale”.
Default value “RGB”.
 training? : boolean, whether the layer is in training mode (can store data for backward).
Default value “True”.
 lda coeff : float, defines the coefficient by which the loss derivative will be multiplied before being sent to the previous layer (since during the backward run we go backwards).
Default value “1”.

 name (optional) : string, name of the node.

Output parameters

 

 image (heterogeneous) – T2 : object, decoded image.

Type Constraints

T1 in (tensor(uint8)) : Constrain input types to 8-bit unsigned integer tensor.

T2 in (tensor(uint8)) : Constrain output types to 8-bit unsigned integer tensor.

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install Deep Learning library to run it).
Table of Contents