Manually Select Multiple Region of Interest in an IMAQ Image

Updated Jan 11, 2018

Reported In


  • Vision Development Module


  • NI-IMAQdx

Issue Details

I have designed a VI to generate and overlay a series of Region of Interest (ROI) on an image and display them in an IMAQ image control. I want to pick out some of them for subsequent processing. Can I manually select ROIs in the control?


ROIs generated programmatically are usually saved to a pre-defined cluster called ROI Descriptor. To select a part of ROIs of an ROI group, in other words, to get a subset needs a rule to identify which one is selected. Being inside a region is a useful and convenient rule that can be set manually with the image display control.

The IMAQ image display control provides some tools on the tool palette for "selecting an area of the image", as in the following figure. You can use these tools to easily draw a region on the displayed image.
Notes: Although it is ROI as well, this ROI (named control ROI) belongs to the display control, but not to the IMAQ image overlay (named generated ROI).

The following VI snippet and steps will show you how to use the rectangle ROI tool of IMAQ image display control to select a subset of generated ROI. These steps assume you already have a VI with IMAQ image display control on the front panel and a set of image ROIs in an ROI Descriptor.
  1. Display the generated ROIs by overlay them on an IMAQ image. You can use IMAQ Overlay ROI at Vision and Motion>>Vision Utilities>>Overlay for that.
  2. Add a control ROI by the rectangle ROI tool on the image display control. You can add a while loop or event structure in diagram to wait for this user operation.
  3. Use property node of the IMAQ image display control to get the ROI Descriptor of the control ROI.
  4. Ungroup the generated ROIs into ROI Descriptor array, using IMAQ Ungroup ROIs at Vision and Motion>>Vision Utilities>>Region of Interest. The array is easier to index and identify one by one.
  5. Compare the boundaries of generated ROI and control ROI, and use the conditional index of for-loop to pick out the generated ROIs that are inside the control ROI. This identification logic can only process rectangular control ROI.
  6. Clear the overlay set at Step 1, and then overlay the re-grouped selected ROI to display. These function VIs used here can be found at Vision and Motion>>Vision Utilities>>Region of interest and Vision and Motion>>Vision Utilities>>Overlay subpanels.
  7. The Selected ROI Descriptor contains only the selected ROIs. You can use it in the subsequent process.


Not Helpful