LightMeterLine Method

NI Vision for Visual Basic

LightMeterLine Method

Syntax

CWMachineVision.LightMeterLine SourceImage, Line, LightMeterLineReport [, ShowSearchArea = True] [, CoordinateTransformation]

Return Type

Long

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

Purpose

Measures the pixel intensities on a line of an image.

Remarks

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

Parameters

SourceImage As CWIMAQImage

The input image.

Line As CWIMAQLine

The line on the image on which to measure the intensities.

LightMeterLineReport As CWMVLightMeterLineReport

On return, a report containing information about the intensities on the selected line.

ShowSearchArea As Variant

[Optional] If True, the search line is overlaid on the image.

This parameter has a default value of True.

CoordinateTransformation As Variant

[Optional] A CWMVCoordinateTransformation object. If supplied, the input line is transformed using this parameter.

Example

Private Sub Run_Click()
    'Inputs to LightMeterLine
    Dim SearchArea As New CWIMAQLine
    Dim Transformation As New CWMVCoordinateTransformation
    
    'Outputs of LightMeterLine
    Dim Report As New CWMVLightMeterLineReport
    
    'Get the line from the viewer.
    CWMachineVision1.GetSelectedLineFromViewer CWIMAQViewer1, SearchArea
    
    'Measure the intensity inside the search region
    CWMachineVision1.LightMeterLine CWIMAQViewer1.Image, SearchArea, Report, , Transformation

    'Display the mean intensity in a text box
    Text1.Text = Report.MeanIntensity
End Sub

See Also

CWIMAQVision.GetLine2

GetSelectedLineFromViewer