Welcome to our Support Center

Cast Image

Description

Converts the current image type to the image type specified by “Target Type”. Type : polymorphic.

 

Input parameters

 

Image Src : class
Target Type : enum,
specifies the image type into which the input image is converted.

    • Grayscale (U8) : 8 bits per pixel (unsigned, standard monochrome)
    • Grayscale (I16) : 16 bits per pixel (signed)
    • RGB (U32) : 32 bits per pixel (red, green, blue, alpha)
    • HSL (U32) : 32 bits per pixel (hue, saturation, luminance, alpha)

Lookup Table : array, is a grayscale replacement table. This input is an array containing a maximum of 256 elements if Image Src is an 8-bit image or a maximum of 65,536 elements if Image Src is a 16-bit image. Individual pixels within the image are not modified when the lookup table is missing a value that corresponds to those pixels. This input is valid only when converting from an 8-bit image to a 16-bit image, from a 16-bit image to an 8-bit image.
Methods : enum, specifies the casting method using which the input image is converted. This is valid only for 16-bit to 8-bit conversions.

    • Use Bit Depth : use the bit depth information to cast.
    • Shift : uses the Number of Shifts input to cast the image. If a 16-bit image is being converted to an 8-bit image using this method, the VI executes this conversion by shifting the 16-bit pixel values to the right by the specified number of shift operations and then truncating to get an 8-bit value. If the value for Number of Shifts is 0, the pixel values are shifted by 0.
    • Use Lookup Table : uses the Lookup Table to perform casting.

Number Of Shifts : integer, specifies the number of right shifts by which each pixel value in the input image is shifted. This is valid only when converting from a 16-bit image to an 8-bit image. The VI executes this conversion by shifting the 16-bit pixel values to the right by the specified number of shift operations, up to a maximum of 8 shift operations, and then truncating to get an 8-bit value. This is valid only when Shift is selected for the Method input.

Output parameters

 

Image Dst : class

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 TIGR library to run it).

Table of Contents