Programmatically Move Region of Interest(ROI) on Image

Updated Jan 11, 2018

Reported In

Software

  • Vision Development Module

Driver

  • NI-IMAQ
  • NI-IMAQdx

Issue Details

I have already generated a group of Region of Interest (ROI) on an image in LabVIEW with Vision Development Module. However, some of them are slightly mismatched the targets. How can I move them?

Solution

In LabVIEW with Vision Development Module, ROIs are saved as a pre-defined cluster called ROI Descriptor. It contains parameters to define a group of ROIs even of different shapes. You can use Vision Utilities VIs that installed with the Vision Development Module to modify the ROI Descriptor. Follow the steps below to add the move ROI function to your program.
  1. Open Function Panel in LabVIEW by Right-click the blank in a VI diagram window, then locate to the Region of Interest subpanel at Vision and Motion>>Vision Utilities>>Region of Interest.
  2. Since ROI Descriptor can describe multiple ROIs, if you only want to move part of them, you can use IMAQ Ungroup ROIs and IMAQ Group ROIs to separate the original ROI Descriptor into several ROI Descriptors.
  3. Use IMAQ Transform ROI to modify the coordinates of the ROI Descriptor. This VI needs two more inputs, Base Reference and New Reference, to define a movement.
  4. Use IMAQ Overlay ROI, located at Function Panel>>Vision and Motion>>Vision Utilities>>Overlay, to show the moved ROIs on the image.
 As a simple example, here is a VI snippet to move a whole group of ROIs by 30 pixels right and 20 pixels left. All the numbers in Base Reference are left zero, and only Origin.X and Origin.Y in New Reference have been changed to 30 and 20.

Additional Information

There are two types of coordinates in ROI Descriptor:
  • Four numbers in Global Rectangle mean the most left, most top, most right and most bottom boundary positions of the whole group of ROIs.
  • Coordinates array describing each ROI, the meaning of these numbers is depended on the ROI shape type. 
If you want to directly modify the internal data of the ROI Descriptor for custom manipulation, you must understand the meaning of all these coordinates and parameters. Refer to NI Vision Help for more information.

WAS THIS ARTICLE HELPFUL?

Not Helpful