Example Code

Zoom and Mask Image using Regions of Interest(ROIs)

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Vision Development Module
  • LabVIEW

Code and Documents

Attachment

Overview

The example demonstrates how to zoom and mask an IMAQ image with a Region of Interest (ROI).

 

Description

You can use the ROI tools in an LabVIEW Image Display control to create ROIs manually. You can use a ROI for example to zoom into a previously selected area or create a mask from that ROI. Also ROI can be converted to masks that can be used to apply a calculation only to a smaller part of the image.
The example shows the original image in the left 'Original Image Display'. The user can then select a ROI in that image display with any ROI tool and after the ROI has been selected the 'Template Image Display' shows the original image zoomed to the selected ROI. The user can then select another ROI and with that ROI a mask will be generated and displayed in the 'Mask Image Display' control.
The example also features a subVI 'Wait for ROI Selection' that can detect an event for the image display control as soon as a ROI has been selected.

 

Requirements

 Software

  • LabVIEW 2012 Base Development System (or compatible)
  • Vision Development Module 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Run the VI
  2. Select a ROI in the left image display
  3. Select a ROI in the middle image display

 

Additional Information or References

Zoom and Mask IMAQ Image using ROI - Front Panel.png 

 

Zoom and Mask IMAQ Image using ROI - Block Diagram.png
 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Jamie Jones
Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.