RejectBorder Method

NI Vision for Visual Basic

RejectBorder Method

Syntax

CWIMAQVision.RejectBorder SourceImage, DestImage [, Connectivity8 = True]

Return Type

Long

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

Purpose

Eliminates particles that touch the border of an image.

Remarks

This method modifies the source image. If you need the original source image, create a copy of the image using the CWIMAQVision.Copy method before using this method.

SourceImage and DestImage must be U8 images.

Parameters

SourceImage As CWIMAQImage

The source image. If the image has a border, the method sets all border pixel values to 0.

DestImage As CWIMAQImage

The resulting image.

Connectivity8 As Variant

[Optional] Set this parameter to True to use connectivity-8 to determine whether particles are touching. Set this parameter to False to use connectivity-4 to determine whether particles are touching. For more information about connectivity, refer to the NI Vision Concepts Manual.

This parameter has a default value of True.

Example

Private Sub Run_Click()
    Dim i As New CWIMAQImage
    
    ' Reject the particles touching the border of the image in Viewer1.
    ' Store the result in i.
    CWIMAQVision1.RejectBorder CWIMAQViewer1.Image, i
End Sub