ConvertByLookup Method

NI Vision for Visual Basic

ConvertByLookup Method

Syntax

CWIMAQVision.ConvertByLookup SourceImage, DestImage, LookupTable

Return Type

Long

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

Purpose

Obsolete—Use Cast instead. Converts an image by using a lookup table that is encoded in floating point values.

Remarks

This function operates on images of type U8, U16, I16, and SGL.

Parameters

SourceImage As CWIMAQImage

The image to be converted.

DestImage As CWIMAQImage

The resulting image. The image type can be the following:

If SourceImage is a U8 image, DestImage can be an I16 or SGL image.

If SourceImage is an I16 image, DestImage can be an SGL image.

LookupTable As Variant

The conversion array. The array can consists of up to 256 elements if SourceImage is a U8 image or 65,536 elements if SourceImage is a I16 image. This array is completed with values equal to the index if it has less elements than the maximum needed by the image type of SourceImage.

Example

Dim i As New CWIMAQImage
Dim lookupTable(0 to 255) As Long
Dim index

' Change the image in Viewer1 to an RGB32 image and 
' store the results in i
CWIMAQVision1.Cast CWIMAQViewer1.Image, i, cwimaqImageTypeRGB32

' Populate the lookupTable with a form of inverse transformation
For index = 0 to 255
    lookupTable(index) = 32767 - (index * 16)
Next

' Change the image in Viewer1 to a 16-bit image using the lookup table
CWIMAQVision1.Cast CWIMAQViewer1.Image, CWIMAQViewer1.Image, _
                   cwimaqImageTypeI16, lookupTable

' Change the image in Viewer1 to an SGL image
' You can use the Type property on the image since there is no need
' for a lookup table or shift value.
CWIMAQViewer1.Image.Type = cwimaqImageTypeSGL

See Also

Cast