Extract2 Method

NI Vision for Visual Basic

Extract2 Method

Syntax

CWIMAQVision.Extract2 SourceImage, DestImage [, Rectangle] [, xSubsample = 1] [, ySubsample = 1]

Return Type

Long

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

Purpose

Extracts (reduces) an image or part of an image with adjustment of the horizontal and vertical resolution.

Remarks

Use this method with U8, I16, SGL, RGB32, and HSL32 images.

Parameters

SourceImage As CWIMAQImage

The image to extract.

DestImage As CWIMAQImage

The resulting image.

Rectangle As Variant

[Optional] A CWIMAQRectangle object defining the portion of the image that the method extracts. The operation applies to the entire image if this parameter is not supplied.

xSubsample As Variant

[Optional] The horizontal sampling step. This parameter defines the columns to extract (the horizontal reduction ratio). For example, set this parameter to 3 to extract one out of every three columns from the SourceImage into the DestImage. The method copies the pixel columns to the destination image without subsampling if you use the default value.

This parameter has a default value of 1.

ySubsample As Variant

[Optional] The vertical sampling step. This parameter defines the rows to extract (the vertical reduction ratio). For example, set this parameter to 3 to extract one out of every three rows from the SourceImage into the DestImage. The method copies the pixel rows to the destination image without subsampling if you use the default value.

This parameter has a default value of 1.

Example

Dim i As New CWIMAQImage
Dim r As New CWIMAQRectangle

' Reduce a 50 x 50 rectangular portion of the image in Viewer1
' starting at (20,30) by a factor of 2.
' Store the result in i.
r.Initialize 20, 30, 50, 50
CWIMAQVision1.Extract2 CWIMAQViewer1.Image, i, r, 2, 2

Extract Example

See Also

Expand2

CWIMAQRectangle