ICogAcqROI SetROIXYWidthHeight Method Cognex VisionPro 9.7
Sets the ROI.

Namespace: Cognex.VisionPro
Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 73.0.0.0
Syntax

void SetROIXYWidthHeight(
	int x,
	int y,
	int width,
	int height
)
Events

Event TypeReason
ICogChangedEvent Changed

Fires when the ROI is changed.

The following state flag may be affected:

Exceptions

ExceptionCondition
ArgumentException

Any parameter is < 0.

Remarks

Sets the acquisition region of interest (ROI).

Note: If the ROI specified extends in the positive direction beyond the bounds specified by the video format, it will be silently clipped.

Examples

using Cognex.VisionPro;

private CogFrameGrabbers myFrameGrabbers;
private ICogFrameGrabber myFrameGrabber;
private ICogAcqFifo myAcqFifo;

private void InitializeFifo()
{
    const string VIDEO_FORMAT = "Sony XC75 640x480";
    ICogAcqROI ROIParams;

    myFrameGrabbers = new CogFrameGrabbers();
    myFrameGrabber = myFrameGrabbers[0];
    myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT, 
        Cognex.VisionPro.CogAcqFifoPixelFormatConstants.Format8Grey, 0, false);

    ROIParams = myAcqFifo.OwnedROIParams;
    if (ROIParams != null)
        ROIParams.SetROIXYWidthHeight(10, 20, 300, 200);
}
Imports Cognex.VisionPro

Private myFrameGrabbers As CogFrameGrabbers
Private myFrameGrabber As Cognex.VisionPro.ICogFrameGrabber
Private myAcqFifo As Cognex.VisionPro.ICogAcqFifo

Private Sub InitializeFifo()
    Const VIDEO_FORMAT = "Sony XC75 640x480"
    Dim ROIParams As Cognex.VisionPro.ICogAcqROI

    myFrameGrabbers = New CogFrameGrabbers
    myFrameGrabber = myFrameGrabbers.Item(0)
    myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT, CogAcqFifoPixelFormatConstants.Format8Grey, 0, False)

    ROIParams = myAcqFifo.OwnedROIParams

    If Not ROIParams Is Nothing Then
        ROIParams.SetROIXYWidthHeight(10, 20, 300, 200)
    End If
End Sub
See Also