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.
- 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.
- 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.
- 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.
- 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.
There are two types of coordinates in ROI Descriptor:
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.
- 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.