ColorBCGTransform Method

NI Vision for Visual Basic

ColorBCGTransform Method

Syntax

CWIMAQVision.ColorBCGTransform SourceImage, DestImage [, RedPlaneBCGOptions] [, GreenPlaneBCGOptions] [, BluePlaneBCGOptions] [, MaskImage]

Return Type

Long

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

Purpose

Applies brightness, contrast, and gamma correction to each plane of a color image.

Remarks

Use this method on RGB32 images.

Parameters

SourceImage As CWIMAQImage

The source image to transform.

DestImage As CWIMAQImage

The result of performing the transform.

RedPlaneBCGOptions As Variant

[Optional] A CWIMAQBCGOptions object that specifies the options to use to transform the red plane of the image.

GreenPlaneBCGOptions As Variant

[Optional] A CWIMAQBCGOptions object that specifies the options to use to transform the green plane of the image.

BluePlaneBCGOptions As Variant

[Optional] A CWIMAQBCGOptions object that specifies the options to use to transform the blue plane of the image.

MaskImage As Variant

[Optional] A CWIMAQImage object that contains the mask applied to the source image. It indicates the region of the image where the ColorBCGTransform is applied. Only pixels in the original image that correspond to a nonzero pixel in the mask are used. A ColorBCGTransform on the complete image occurs if no mask image is passed in.

Example

Private Sub Run_Click()
    Dim MaskImage As New CWIMAQImage
    Dim RedOptions As New CWIMAQBCGOptions
    Dim BlueOptions As New CWIMAQBCGOptions
    
    'Create a mask image from the regions on Viewer1
    CWIMAQVision1.RegionsToMask MaskImage, CWIMAQViewer1.Regions, CWIMAQViewer1.Image
        
    'Set up the options for the ColorBCGTransform
    
    'Decrease the brightness of the red plane
    RedOptions.Brightness = 100
       
    'Increase the contrast and gamma of the blue plane
    BlueOptions.Contrast = 90
    BlueOptions.Gamma = 2
    
    'Perform a ColorBCGTransform on a portion of Image using the mask
    'Store the results in the image in Viewer2.
    CWIMAQViewer2.Image.Type = cwimaqImageTypeRGB32
    CWIMAQVision1.ColorBCGTransform CWIMAQViewer1.Image, CWIMAQViewer2.Image, RedOptions, , BlueOptions, MaskImage
End Sub

See Also

BCGTransform

CWIMAQBCGOptions