IC Imaging Control .NET

ROI Filter

ROI Filter

The ROI filter cuts a region of interest out of the incoming frames. It creates a new output video format.

Using the ROI Filter

The ROI filter is loaded by an application using following code:

[VB.NET]
Dim ROIFilter As FrameFilter ROIFilter = IcImagingControl1.FrameFilterCreate("ROI", "") If ROIFilter Is Nothing Then MsgBox("Failed to create ROIFilter") Else IcImagingControl1.DeviceFrameFilters.Add(ROIFilter) End If
[C#]
FrameFilter ROIFilter; ROIFilter = ICImagingControl1.FrameFilterCreate("ROI", ""); if (ROIFilter == null) MessageBox.Show("Failed to create ROIFilter"); else ICImagingControl1.DeviceFrameFilters.Add(ROIFilter);

Parameters

The part of the image that is copied to the destination frame is determined by four filter parameters:

Left
This value specifies the left column on the source frame at which the region of interest (ROI) starts. This value is used to move the region of interest horizontally to the source frame. It can be changed regardless of whether the live video is running or not.
Top
This value specifies the top row on the source frame at which the region of interest starts. This value is used to move the region of interest vertically to the source frame. It can be changed regardless of whether the live video is running or not.
Width
This value specifies the width of the region of interest. It can only be set while the live video is stopped. Otherwise, the resulting video format would be changed.
The width will be aligned to eight pixels in the filter.
Height
This value specifies the height of the region of interest. It can only be set while the live video is stopped. Otherwise, the resulting video format would be changed.

Property Dialog

The dimensions and the start positions of the region of interest can be specified in the ROI filter's property dialog:

image

Programmatically Access the Parameter

The following source code can be used, if the parameter should be set by an application:

[VB.NET]
Dim left As Integer Dim top As Integer Dim height As Integer Dim width As Integer ' Retrieve the current ROI rectangle. left = ROIFilter.GetIntParameter("Left") top = ROIFilter.GetIntParameter("Top") height = ROIFilter.GetIntParameter("Height") width = ROIFilter.GetIntParameter("Width") ' Set a new ROI. left = 100 top = 50 ' The position of the ROI can be set, regardless of whether the live video is running ' because the size of the resulting video format is not changed. ROIFilter.SetIntParameter("Left", left) ROIFilter.SetIntParameter("Top", top) If Not IcImagingControl1.LiveVideoRunning Then ' A new ROI width and height can only be set, while the live video is stopped. Otherwise, ' an error is returned by setParameter(); height = 120 width = 180 ROIFilter.SetIntParameter("Height", height) ROIFilter.SetIntParameter("Width", width) End If
[C#]
// Retrieve the current ROI rectangle. int left = ROIFilter.GetIntParameter("Left"); int top = ROIFilter.GetIntParameter("Top"); int height = ROIFilter.GetIntParameter("Height"); int width = ROIFilter.GetIntParameter("Width"); // Set a new ROI. left = 100; top = 50; // The position of the ROI can be set regardless of whether the live video is running // because the size of the resulting video format is not changed. ROIFilter.SetIntParameter("Left", left); ROIFilter.SetIntParameter("Top", top); if( !ICImagingControl1.LiveVideoRunning ) { // A new ROI width and height can only be set, while the live video is stopped. // Otherwise, an error is returned by setParameter(); height = 120; width = 180; ROIFilter.SetIntParameter("Height", height); ROIFilter.SetIntParameter("Width", width); }

<< IC Imaging Control Standard Filters

Get in touch with us


About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us