Divide Method

NI Vision for Visual Basic

Divide Method

Syntax

CWIMAQVision.Divide SourceImage, Operand, DestImage

Return Type

Long

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

Purpose

Divides an image by an image or a constant.

Remarks

Use this method with U8, I16, and SGL images. To divide an image by a constant, DestImage and SourceImage must be the same type of image. You cannot divide an image by zero. If you set the constant to 0, the method automatically replaces it with 1. If Operand is an image, its type depends on the type of SourceImage as follows:

If SourceImage is a U8 image, Operand must be a U8 image.
If SourceImage is an I16 image, Operand must be an I16 or U8 image.
If SourceImage is an SGL image, Operand must be an SGL, I16, or U8 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.

Parameters

SourceImage As CWIMAQImage

The first input image.

Operand As Variant

Either 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

' Divide the image in Viewer1 by a constant
' Store the result in i
CWIMAQVision1.Divide CWIMAQViewer1.Image, 50, i

' Divide the image in Viewer1 by the image in i
' Do the division inplace (store the result in i)
CWIMAQVision1.Divide CWIMAQViewer1.Image, i, i