Max Method

NI Vision for Visual Basic

Max Method

Syntax

CWIMAQVision.Max SourceImage, Operand, DestImage

Return Type

Long

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

Purpose

Computes the maximum of the pixel values of two images or the maximum of a the pixel values and a constant.

Remarks

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

If Operand is an image, the method copies the larger pixel value of the two source pixels into the destination for each pixel. If Operand is a constant, the method copies the source image to the destination in the following manner: If the source image pixel value is greater than the given constant, the method copies the source pixel to the destination. Otherwise the method copies the constant value to the destination.

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.

Parameters

SourceImage As CWIMAQImage

The first input image.

Operand As Variant

The second input image or a constant.

DestImage As CWIMAQImage

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

Example

Dim i As New CWIMAQImage

' Find the max of a constant and the image in Viewer1.
' Store the result in i
CWIMAQVision1.Max CWIMAQViewer1.Image, 50, i

' Find the max of the pixels image i and the image in Viewer1.
' Do the operation inplace (store the result in i)
CWIMAQVision1.Max CWIMAQViewer1.Image, i, i

See Also

Min