ColorUserLookup Method

NI Vision for Visual Basic

ColorUserLookup Method

Syntax

CWIMAQVision.ColorUserLookup SourceImage, DestImage, ColorFormat [, Plane1] [, Plane2] [, Plane3] [, MaskImage]

Return Type

Long

On success, this method returns 0. On failure, this method returns a negative number.

Purpose

Performs a transformation on an image by replacing each pixel value in a given color plane with the lookup table entry corresponding to that value.

Remarks

Use this method with image types RGB32 and HSL32. MaskImage must be a U8 image.

Parameters

SourceImage As CWIMAQImage

The image on which to apply the lookup operation.

DestImage As CWIMAQImage

The resulting color image.

ColorFormat As CWIMAQColorFormats

The color space in which to apply the lookup operation.

Plane1 As Variant

[Optional] The lookup table to apply to the red or hue color plane. This array can contain up to 256 elements. If you specify fewer than 256 elements, the method fills the remaining elements with grayscale values. Do not set this parameter if you do not want to replace pixel values in this plane.

Plane2 As Variant

[Optional] The lookup table to apply to the green or saturation color plane. This array can contain up to 256 elements. If you specify fewer than 256 elements, the method fills the remaining elements with grayscale values. Do not set this parameter if you do not want to replace pixel values in this plane.

Plane3 As Variant

[Optional] The lookup table to apply to the blue, luminance, value, or intensity color plane. This array can contain up to 256 elements. If you specify fewer than 256 elements, the method fills the remaining elements with grayscale values. Do not set this parameter if you do not want to replace pixel values in this plane.

MaskImage As Variant

[Optional] A CWIMAQImage object that indicates the region in the image to use for the color user lookup. The method processes only those pixels in the image whose corresponding pixels in the mask are non-zero. Do not set this parameter if you want to transform the entire image.

Example

Dim i As New CWIMAQImage
Dim redPlaneLookupTable
Dim greenPlaneLookupTable

'Do something to populate redPlaneLookupTable and greenPlaneLookupTable

'Perform the ColorUserLookup on the image in Viewer1 and
'store the result in i
i.Type = cwimaqImageTypeRGB32
CWIMAQVision1.ColorUserLookup CWIMAQViewer1.Image, i, _
                              cwimaqColorFormatRGB, _
                              redPlaneLookupTable, greenPlaneLookupTable