Inverse Method

NI Vision for Visual Basic

Inverse Method

Syntax

CWIMAQVision.Inverse SourceImage, DestImage [, MaskImage]

Return Type

Long

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

Purpose

Inverts the pixel intensities of an image in the following manner:

Let

dynamicMin = 0 (U8 images) or the smallest initial pixel value (I16 and SGL images)

dynamicMax = 255 (U8 images) or the largest initial pixel value (I16 and SGL images)

Each pixel value p is replaced by f(p), where f(p) = dynamicMax - p + dynamicMin

Remarks

Use this method with U8, I16, and SGL images.

Parameters

SourceImage As CWIMAQImage

The image to process.

DestImage As CWIMAQImage

The results of the operation.

MaskImage As Variant

[Optional] A CWIMAQImage object that contains the mask applied to the source image. It indicates the region of the image where the method applies the inverse. 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 invert the pixel intensities for the entire image.

Example

Dim i As New CWIMAQImage
Dim maskImage As New CWIMAQImage

' Invert a portion of the image in Viewer1 defined by the regions on
' Viewer1 and store the result in i.
CWIMAQVision1.RegionsToMask maskImage, CWIMAQViewer1.Regions
CWIMAQVision1.Inverse CWIMAQViewer1.Image, i, maskImage