3 steps  for using the Region Of Interest (ROI) function of a machine vision camera

 

ROI explanation


This article demonstrates how to set up and use the Region of Interest function of our machine vision cameras, how to resize an image, and how to obtain the desired area. This is generally used for:
-    decreasing the amount of data that is collected and received
-    cutting down on the demanded bandwidth needed
-    increasing the framerate of our machine vision cameras
-    narrowing the view for an exact area


This article explains how we set a ROI and offset an image from the top left corner of an image to the desired location. By following the 3 steps below, you can specify the size and position of the machine vision cameras ROI.

Step 1: Check the resolution and determine your Region Of Interest

First, check the maximum image size (resolution) of your machine vision camera, and specify your desired ROI.

Galaxy Viewer ROI settings

 



For testing, we used an industrial camera with a max resolution of 3840x2748 pixels. We want our ROI to be 1000x1000 pixels inside the machine vision camera.

Example of Setting an ROI

Step 2: Set Region Of Interest parameters in the SDK menu

***The menu only works when NO acquisition is running***
Open the Daheng GalaxyView SDK to set the ROI parameters of your machine vision camera. You will need to navigate and expand the ‘ImageFormatControl’ menu. Change the 2 parameters ‘Width’ and ‘height’ (see orange box in the picture below) to adjust the size of your ROI to your desired Values. For this case, we used the values ‘Width: 1000; Height: 1000’.

   

Galaxy Viewer OFFset
ROI without an Offset



The ‘OffsetX’ and ‘OffsetY’ (yellow circle in the image) are used to create where the Region of Interest of 1000x1000 pixels will be.  

Step 3: Defining the ROI offset values

To define the ROI offset values, you must keep in mind that the count begins from the top left corner (starting point of ROI) of the beginning image, and counts down towards the bottom right corner.

Example 1; Starting position of the Region of Interest in center of the image

The image center is at half of the 3840 pixels for the width (x), and half of the 2748 for the height (y), [x:1920, y:1374]. If changing the offset position to [x:1920, y:1374], our Region of Interest of 1000x1000 will start in the centre of the image.
However, the center of the ROI will not be the centre of the whole image.

Calculate the right Offset

Example 2: Centre of the ROI = center of the complete image

If we want the ROI to be in the middle of the image, we use the following formula:

OffsetX = (MaxImageWidth/2)-(RoiWidth/2) = (3840 / 2) – (1000 / 2) = 1420
OffsetY = (MaxImageHeight/2)-(RoiHeight/2) = (2748 / 2) – (1000 / 2) = 874
 

Implementing these 3 steps results in your start position for defining your preferred position and the exact size of the Region Of Interest.

    

Galaxy Viewer Offset
Get the center of the image

Region Of Interest ; its impact on the framerate

Decreasing the Region of Interest of a machine vision camera will result in a higher framerate. The less pixels you have, means the less time to acquire an image. Therefore, the less pixels result in less data output, which then increases the frames per second to utilize the maximum bandwidth.

For example, if we take the MER-1070-10GM, with a maximum framerate of 10 FPS at a maximum resolution (3840x2748), we can follow the formula to calculate the new framerate when we set a custom R.O.I. e.g. 1000x1000.

FrameRate = 1 / (Traw ⋅ Height)

Where height is the number of pixels of the ROI and Traw is a fixed value, that can be calculated by (1/maxFPS)/maxHeight. If we take the MER-1070 as an example, we first calculate Traw by using the formula: Traw = (1/10)/2748 = 0.0000369. Now we can calculate the new framerate. Framerate = 1/(0.0000369*1000) = 27.48 FPS.

 

Please note that the actual framerate might differ from the calculated value, more information can be found in the following article: Knowledge Center - Frame rate calculator . Do you need help calculating the framerate? Or setting the Region Of Interest? Reach out below.