IMAQ Cast Image VI

LabView NI Vision

IMAQ Cast Image VI

Owning Palette: Image ManagementInstalled With: NI Vision Development Module

Converts the current image type to the image type specified by Image Type. If you specify a lookup table, the IMAQ Cast Image VI converts the image using a lookup table. If 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 and then truncating to get an 8-bit value.

Refer to the NI Vision Concepts Manual for more information about converting image types.

Note  Refer to Casting Images to learn how the VI casts pixel values when the Image Src type and the Image Type parameter are not the same.

Examples

IMAQ Cast Image

ci32.gif

# Shifts 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. Enter a value of –1 to ignore the bit depth and shift 0. Enter a value of 0 to use the bit depth to cast the image. Refer to the IMAQ Image Bit Depth VI for information about bit depth.

cgenclasstagrefflat.gif

Image Src is a reference to the source image.

cgenclasstagrefflat.gif

Image Dst is a reference to the destination image.

c1dsgl.gif

Lookup Table 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. The array contains values equal to the index if there are fewer than the amount determined by the image type in Image Src. You can use Lookup Table to calculate a function that gives a relation between a gray-level value and a user value. 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, or from an 8-bit or 16-bit image to a 32-bit floating-point image.

After converting Image Src into a floating-point type image, you can quantify the image or regions in the image using VIs capable of analyzing floating-point type images.

cerrcodeclst.gif

error in (no error) describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.

cbool.gif

status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.

ci32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

cstr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

cu32.gif

Image Type specifies the image type into which the input image is converted. The following values are valid:

Grayscale (U8) (0)

8 bits per pixel (unsigned, standard monochrome)

Grayscale (16) (1)

16 bits per pixel (signed)

Grayscale (SGL) (2)

32 bits per pixel (floating point)

Complex (CSG) (3)

2 × 32 bits per pixel (floating point)

RGB (U32) (4)

32 bits per pixel (red, green, blue, alpha)

HSL (U32) (5)

32 bits per pixel (hue, saturation, luminance, alpha)

RGB (U64) (6)

64 bits per pixel (red, green, blue, alpha)

Grayscale (U16) (7)

16 bits per pixel (unsigned)

igenclasstagrefflat.gif

Image Dst Out is a reference to the destination image. If Image Dst is connected, Image Dst Out is the same as Image Dst. Otherwise, Image Dst Out refers to the image referenced by Image Src.

ierrcodeclst.gif

error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

ibool.gif

status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.

ii32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

istr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

Examples

Refer to the following for an example of how to use this VI.

  • LabVIEW\examples\Vision\2. Functions\Operators\Image Averaging Example.vi