LineProfile2 Method

NI Vision for Visual Basic

LineProfile2 Method

Syntax

CWIMAQVision.LineProfile2 SourceImage, Line, ProfileReport

Return Type

Long

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

Purpose

Computes the profile of a line of pixels. This method returns other information such as pixel statistics and the coordinates of the pixels along the line.

Remarks

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

Parameters

SourceImage As CWIMAQImage

The image on which the method computes the line profile.

Line As CWIMAQLine

The line along which the method computes the profile.

ProfileReport As CWIMAQProfileReport

On return, a report object containing relevant information about the pixels in the indicated line.

Example

'This example requires you to have a ListBox named List1 on the form.
Dim line As New CWIMAQLine
Dim report As New CWIMAQProfileReport
Dim i
Dim profileArray

' Initialize the line
line.Initialize 10, 10, 100, 100

' Find the profile along the line in the image on Viewer1
CWIMAQVision1.LineProfile2 CWIMAQViewer1.Image, line, report

' Display the pixel values in the listbox
If report.Count > 0 Then
    profileArray = report(1).profileArray
    List1.Clear
    For i = LBound(profileArray) To UBound(profileArray)
        List1.AddItem profileArray(i)
    Next
End If

Line Profile Example