MathLookup Method

NI Vision for Visual Basic

MathLookup Method

Syntax

CWIMAQVision.MathLookup SourceImage, DestImage, Operator [, XValue] [, MinValue = 0] [, MaxValue = 0] [, MaskImage]

Return Type

Long

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

Purpose

Converts the pixel values of an image by replacing them with values from a defined lookup table. This method modifies the dynamic range of either part of an image or the complete image, depending on the type of curve chosen.

Remarks

Use this method with U8, I16, and SGL images. MaskImage must be a U8 image.

Parameters

SourceImage As CWIMAQImage

The image to process.

DestImage As CWIMAQImage

The resulting image.

Operator As CWIMAQMathLookupOperators

The transform function to use.

XValue As Variant

[Optional] The power to which the method raises the pixel value if you set Operator to cwimaqMathLookupPowX or cwimaqMathLookupPow1X.

MinValue As Variant

[Optional] The smallest pixel value on which the method applies the transform.

This parameter has a default value of 0.

MaxValue As Variant

[Optional] The largest pixel value on which the method applies the transform.

This parameter has a default value of 0.

MaskImage As Variant

[Optional] A CWIMAQImage object that specifies the region in the image to use for the math 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 apply the transfer function to the entire image.

Example

Dim i As New CWIMAQImage
Dim maskImage As New CWIMAQImage

' Apply a transformation function to a portion of the image in Viewer1
' defined by regions selected on Viewer1.
' Store the result in i.
CWIMAQVision1.RegionsToMask maskImage, CWIMAQViewer1.regions
CWIMAQVision1.MathLookup CWIMAQViewer1.Image, i, _
                         cwimaqMathLookupPow1X, 5, , , maskImage

Math Lookup Example