ExtractColorPlanes Method

NI Vision for Visual Basic

ExtractColorPlanes Method

Syntax

CWIMAQVision.ExtractColorPlanes SourceImage, DestImage1, DestImage2, DestImage3, ColorFormat

Return Type

Long

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

Purpose

Extracts the three planes (RGB, HSL, HSV, or HSI) from an image. The type of planes that you extract does not need to be the same as the image type. For example, you can extract the Hue, Saturation, and Luminance plane from an RGB32 image. Use ExtractSingleColorPlane to extract a single plane from a color image.

Remarks

The source image must be RGB32, HSL32, or RGBU64 and the destination image must be U8 for RGB32 and HSL32 and I16 for RGBU64. Only the red, green, or blue plane can be extracted from RGBU64 images.

Parameters

SourceImage As CWIMAQImage

The color image from which the function extracts the color planes.

DestImage1 As CWIMAQImage

The image for the first extracted plane. It contains either the red plane (RGB) or the hue plane (HSL, HSV, or HSI).

DestImage2 As CWIMAQImage

The image for the second extracted plane. It contains either the green plane (RGB) or the saturation plane (HSL, HSV, or HSI).

DestImage3 As CWIMAQImage

The image for the third extracted plane. It contains either the blue plane (RGB), the luminance plane (HSL), the value plane (HSV), or the Intensity plane (HSI).

ColorFormat As CWIMAQColorFormats

The color space used for this operation.

Example

' This example assumes that the image in Viewer1 is an RGB32 image.
Dim red As New CWIMAQImage
Dim green As New CWIMAQImage
Dim blue As New CWIMAQImage
Dim hue As New CWIMAQImage
Dim saturation As New CWIMAQImage
Dim luminance As New CWIMAQImage
Dim value As New CWIMAQImage
Dim intensity As New CWIMAQImage

' Extract the red, green and blue planes 
' from the image in Viewer1.
CWIMAQVision1.ExtractColorPlanes CWIMAQViewer1.Image, _
                                 red, green, blue, _
                                 cwimaqColorFormatRGB
' Extract the hue, saturation and luminance planes 
' from the image in Viewer1.
CWIMAQVision1.ExtractColorPlanes CWIMAQViewer1.Image, _
                                 hue, saturation, luminance, _
                                 cwimaqColorFormatHSL
' Extract the hue, saturation, and intensity planes 
' from the image in Viewer1.
CWIMAQVision1.ExtractColorPlanes CWIMAQViewer1.Image, _
                                 hue, saturation, intensity, _
                                 cwimaqColorFormatHSI
' Extract the hue, saturation, and value planes 
' from the image in Viewer1.
CWIMAQVision1.ExtractColorPlanes CWIMAQViewer1.Image, _
                                 hue, saturation, value, _
                                 cwimaqColorFormatHSV

See Also

ExtractSingleColorPlane

ReplaceColorPlanes