imaqArrayToImage

NI Vision for LabWindows/CVI Function

imaqArrayToImage

Usage

int imaqArrayToImage(Image* image, const void* array, int numCols, int numRows);

Purpose

Sets the pixels of an image to the values in a given array. This function resizes the image to the size of the source array.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_U16, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL, IMAQ_IMAGE_COMPLEX, IMAQ_IMAGE_RGB, IMAQ_IMAGE_HSL, IMAQ_IMAGE_RGB_U64

Parameters

Name

Type

Description

image Image* The image whose pixels the function sets to match the input array.
array const void* The two-dimensional array of pixel values. This parameter is required and cannot be NULL.
numCols int The number of columns in the data array.
numRows int The number of rows in the data array.

Return Value

Type

Description

int On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError().

Parameter Discussion

The type of the array you provide depends on the image type, as follows:

Image Type Array Type
IMAQ_IMAGE_U8 unsigned char
IMAQ_IMAGE_U16 unsigned short
IMAQ_IMAGE_I16 short
IMAQ_IMAGE_SGL float
IMAQ_IMAGE_COMPLEX Complex
IMAQ_IMAGE_RGB RGBValue structures
IMAQ_IMAGE_HSL HSLValue structures
IMAQ_IMAGE_RGB_U64 RGBU64Value structures