Sets the ROI.
Namespace: Cognex.VisionProAssembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 65.1.0.0
Syntax
Parameters
- x
- Type: System Int32
The x-coordinate of the start of the ROI.
- y
- Type: System Int32
The y-coordinate of the start of the ROI.
- width
- Type: System Int32
The width of the ROI
- height
- Type: System Int32
The height of the ROI.
Events
| Event Type | Reason |
|---|---|
| ICogChangedEvent Changed | Fires when the ROI is changed. The following state flag may be affected: |
Exceptions
| Exception | Condition |
|---|---|
| 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 SubSee Also