LightMeterPoint Method

NI Vision for Visual Basic

LightMeterPoint Method

Syntax

CWMachineVision.LightMeterPoint SourceImage, Point, GrayLevelIntensity [, 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 in a 3 x 3 pixel neighborhood centered on a point of an image.

Remarks

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

Parameters

SourceImage As CWIMAQImage

The input image.

Point As CWIMAQPoint

The point around which to measure the intensities.

GrayLevelIntensity As Single

On return, the intensity in the 3 x 3 pixel neighborhood centered on the point.

ShowSearchArea As Variant

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

This parameter has a default value of True.

CoordinateTransformation As Variant

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

Example

Private Sub Run_Click()
    'Inputs to LightMeterPoint
    Dim SearchArea As New CWIMAQPoint
    Dim Transformation As New CWMVCoordinateTransformation
    
    'Outputs of LightMeterPoint
    Dim MeasuredIntensity As Single
        
    'Get the search area from the viewer
    CWMachineVision1.GetSelectedPointFromViewer CWIMAQViewer1, SearchArea
    
    'Measure the intensity inside the search region
    CWMachineVision1.LightMeterPoint CWIMAQViewer1.Image, SearchArea, MeasuredIntensity, , _
                                     Transformation
                                     
    'Display the mean intensity in a text box
    Text1.Text = MeasuredIntensity
End Sub

See Also

CWIMAQImage.ImageToArray

GetSelectedPointFromViewer