Subtract Method

NI Vision for Visual Basic

Subtract Method

Syntax

CWIMAQVision.Subtract SourceImage, Operand, DestImage

Return Type

Long

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

Purpose

Subtracts an image from an image or subtracts a constant from an image.

Remarks

Use this method with U8, I16, SGL, or RGB32 images.

SourceImage and DestImage must of the same type of image. If Operand is an image, the type of Operand depends on the type of SourceImage, as follows:

  • If SourceImage is U8, Operand must be U8.

  • If SourceImage is I16, Operand must be I16 or U8.

  • If SourceImage is SGL, Operand must be SGL, I16, or U8.

  • If SourceImage is RGB32, Operand must be RGB32 or U8.

This method is optimized for MMX.

Parameters

SourceImage As CWIMAQImage

The first input image.

Operand As Variant

The second input image or a constant. Constants are rounded down if SourceImage is encoded as an integer.

DestImage As CWIMAQImage

The resulting image. It can be one of the source images.

Example

Dim i As New CWIMAQImage

' Subtract a constant from an image in Viewer1
' Store the result in i
CWIMAQVision1.Subtract CWIMAQViewer1.Image, 50, i

' Subtract image i from the image in Viewer1
' Do the subtraction in-place (store the result in i)
CWIMAQVision1.Subtract CWIMAQViewer1.Image, i, i