ReplaceColorPlanes Method

NI Vision for Visual Basic

ReplaceColorPlanes Method

Syntax

CWIMAQVision.ReplaceColorPlanes SourceImage, DestImage [, Plane1] [, Plane2] [, Plane3], ColorFormat

Return Type

Long

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

Purpose

Replaces one or more image planes from a color image (RGB, HSL, HSV, or HSI). The method replaces only the planes supplied as input. If all three planes are supplied, the source image is ignored, and only the destination image is used. The image is resized to the dimensions of the planes passed on input. Therefore, their sizes must be identical. If one or two planes are supplied, the planes must have the same dimension as the source image.

Remarks

Use this method with RGB32, HSL32, and RGBU64 images. Only RGB planes can be replaced in an RGBU64 image.

All source images must be the same size.

Parameters

SourceImage As CWIMAQImage

The source image.

DestImage As CWIMAQImage

The image that has its color planes replaced. This input is ignored if all three planes are specified.

Plane1 As Variant

[Optional] The first plane of replacement data. For RGB32 and HSL32 images, the plane is a CWIMAQImage object of type U8 that contains either the red plane (RGB) or the hue plane (HSL, HSV, or HSI). For RGBU64 images, the plane is a CWIMAQImage of type I16 that contains the red plane (RGB). Do not set this parameter if you do not want to replace the red or hue plane.

Plane2 As Variant

[Optional] The second plane of replacement data. For RGB32 and HSL32 images, the plane is a CWIMAQImage object of type U8 that contains either the green plane (RGB) or the saturation plane (HSL, HSV, or HSI). For RGBU64 images, the plane is a CWIMAQImage of type I16 that contains the green plane (RGB). Do not set this parameter if you do not want to replace the green or saturation plane.

Plane3 As Variant

[Optional] The second plane of replacement data. For RGB32 and HSL32 images, the plane is a CWIMAQImage object of type U8 that contains either the blue plane (RGB), the luminance plane (HSL), the value plane (HSV), or the intensity plane (HSI). For RGBU64 images, the plane is a CWIMAQImage of type I16 that contains the blue plane (RGB). Do not set this parameter if you do not want to replace the blue, light, value, or intensity plane.

ColorFormat As CWIMAQColorFormats

The color space for the operation.

Example

Private Sub Run_Click()
    Dim redPlane as new CWIMAQImage

    CWIMAQVision1.ReplaceColorPlanes CWIMAQViewer1.Image, CWIMAQViewer1.Image, redPlane, , , cwimaqColorFormatRGB
End Sub