BCGTransform Method

NI Vision for Visual Basic

BCGTransform Method

Syntax

CWIMAQVision.BCGTransform SourceImage, DestImage, BCGOptions [, MaskImage]

Return Type

Long

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

Purpose

Applies brightness, contrast, and gamma correction to an image by computing and applying a lookup table. The method computes the lookup table based on the Brightness, Contrast, and Gamma values.

Remarks

Use this method with U8 images. MaskImage must be a U8 image.

Parameters

SourceImage As CWIMAQImage

The image to process.

DestImage As CWIMAQImage

The result of performing the BCGTransform.

BCGOptions As CWIMAQBCGOptions

A CWIMAQBCGOptions object that specifies the options to use to perform the transform.

MaskImage As Variant

[Optional] A CWIMAQImage object that contains the mask applied to the source image. MaskImage specifies the region of the source image in which the method applies the brightness, contrast, and gamma correction. The method applies the correction to only those source pixels whose corresponding mask pixels are non-zero. Do not set this parameter if you want the method to correct the entire image.

Example

Private Sub Run_Click()
    Dim MaskImage As New CWIMAQImage
    Dim Options As New CWIMAQBCGOptions
    
    'Increase the brightness of the image in Viewer1 and
    'store the results in the image in Viewer2.
    Options.Brightness = 200
    CWIMAQVision1.BCGTransform CWIMAQViewer1.Image, CWIMAQViewer2.Image, Options
    
    'Create a mask image from the regions on Viewer1
    CWIMAQVision1.RegionsToMask MaskImage, CWIMAQViewer1.Regions, CWIMAQViewer1.Image
    
    'Perform a BCGTransform on a portion of Image using the mask
    'Do this operation inplace (store the results in the image in Viewer2)
    Options.Brightness = 200
    Options.Contrast = 20
    Options.Gamma = 0.7
    CWIMAQVision1.BCGTransform CWIMAQViewer2.Image, CWIMAQViewer2.Image, Options, MaskImage
End Sub

BCG Transform Example

See Also

ColorBCGTransform

CWIMAQBCGOptions