GetLine2 Method

NI Vision for Visual Basic

GetLine2 Method

Syntax

CWIMAQVision.GetLine2 SourceImage, Line, Array

Return Type

Long

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

Purpose

Returns the pixel values along a given line in an image.

Remarks

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

If the starting or ending point of the line is outside the image, the line clips at the last visible pixel.

Parameters

SourceImage As CWIMAQImage

The source image.

Line As CWIMAQLine

Specifies the line of pixels to extract.

Array As Variant

On return, the array of pixel values extracted from the image.

Example

Private Sub Run_Click()
    Dim line As New CWIMAQLine
    Dim pixelArray
    
    ' Initialize the line
    line.Initialize 10, 10, 200, 200
    
    ' Get the pixels from the image in Viewer1
    CWIMAQVision1.GetLine2 CWIMAQViewer1.Image, line, pixelArray
    
    ' Set this line of pixels at a different
    ' location into the same image.
    line.Initialize 10, 200, 200, 10
    CWIMAQVision1.SetLine2 CWIMAQViewer1.Image, line, pixelArray
End Sub