imaqImageToArray

NI Vision for LabWindows/CVI Function

imaqImageToArray

Usage

void* imaqImageToArray(const Image* image, Rect rect, int* columns, int* rows);

Purpose

Creates a two-dimensional array from an image.

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 const Image* The image from which the function makes the array.
rect Rect Specifies a rectangular region of the image to return. Set this parameter to IMAQ_NO_RECT if you want the function to return the whole image.
columns int* The number of columns in the returned array. Set this parameter to NULL if you do not need this information.
rows int* The number of rows in the returned array. Set this parameter to NULL if you do not need this information.

Return Value

Type

Description

void* On success, this function returns a two-dimensional array. The type of the returned array depends on the image type, as follows:

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


On failure, this function returns NULL. To get extended error information, call imaqGetLastError(). When you are finished with the array, dispose of it by calling imaqDispose().