MulDiv Method
Syntax
CWIMAQVision.MulDiv SourceImageA, SourceImageB, DestImage [, Constant = 255]
Return Type
On success, this method returns 0. On failure, this method returns a negative number.
Purpose
Computes a ratio between two source images.
Remarks
Use this method with U8, I16, SGL, and RGB32 images. All images must be the same type.
The method finds the ratio by multiplying each pixel value in the first source image by a constant. The method divides the result of the multiplication by the corresponding pixel in the second source image. The final result is stored in the destination image.
You can use this method to correct a background if the background is lighter than the image. In a background correction, the first source image is the acquired image and the second source image is the background image.
Parameters
SourceImageA As CWIMAQImage
The first input image.
SourceImageB As CWIMAQImage
The second input image.
DestImage As CWIMAQImage
The resulting image. It can be one of the source images.
Constant As Variant
[Optional] The value by which the method multiplies the first image.
This parameter has a default value of 255.
Example
Dim i As New CWIMAQImage ' Perform a Muldiv operation using the images on Viewer1 and Viewer2. ' Store the result in i CWIMAQVision1.MulDiv CWIMAQViewer1.Image, CWIMAQViewer2.Image, i, 30 ' Perform a Muldiv operation using the images on Viewer1 and i. ' Store the result in i CWIMAQVision1.MulDiv CWIMAQViewer1.Image, i, i, 10