Resample2 Method

NI Vision for Visual Basic

Resample2 Method

Syntax

CWIMAQVision.Resample2 SourceImage, DestImage, Method, NewWidth, NewHeight [, Rectangle]

Return Type

Long

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

Purpose

Resamples an image to a user-defined size. You can use this method to display a reduced or enlarged image.

Remarks

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

SourceImage and DestImage must be the same type of image.

Parameters

SourceImage As CWIMAQImage

The image to resample.

DestImage As CWIMAQImage

The image into which the method places the resampled data. This image may be the same as SourceImage.

Method As CWIMAQInterpolateMethods

Specifies the type of interpolation used to resample the image.

NewWidth As Long

Gives the final width of the image.

NewHeight As Long

Gives the final height of the image.

Rectangle As Variant

[Optional] Specifies the rectangular area to resample. If this parameter is not supplied, then the entire image is resampled.

Example

Private Sub Run_Click()
    Dim i As New CWIMAQImage
    
    ' Enlarge the image in Viewer1 to twice its original size.
    ' Store the result in i.
    CWIMAQVision1.Resample2 CWIMAQViewer1.Image, i, _
                            cwimaqInterpolateBiLinear, _
                            CWIMAQViewer1.Image.Width * 2, _
                            CWIMAQViewer1.Image.Height * 2
End Sub