Add Method

NI Vision for Visual Basic

Add Method

Syntax

CWIMAQVision.Add SourceImage, Operand, DestImage

Return Type

Long

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

Purpose

Adds an image to an image or a constant to an image.

Remarks

Use this method with image types U8, I16, SGL, and RGB32.

To add a constant to an image, DestImage and SourceImage must be the same type of image. If Operand is an image and Operand is of a type that contains more bits per pixel than SourceImage, Operand and DestImage must be the same type of image. Otherwise, SourceImage and DestImage must be the same type of image.

If Operand is an image, the image type of Operand depends on the image type of SourceImage, as follows:

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

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

If SourceImage is RGB, Operand must be RGB or U8.

This method is optimized for MMX.

Parameters

SourceImage As CWIMAQImage

The first input image.

Operand As Variant

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

DestImage As CWIMAQImage

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

Example

Dim i As New CWIMAQImage

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

' Add image i to the image in Viewer1.
' Do the addition inplace (store the result in i)
CWIMAQVision1.Add CWIMAQViewer1.Image, i, i

Add Example