Overview
The example demonstrates how to apply a ROI and mask an image at run-time.
Description
Using a Region of Interest (ROI) can significantly reduce computation time and allow for better image processing performance. There may be times when the ROI needs to be changed during a continuous image grab. A user can update an ROI on a front panel using the ROI tools. This example shows how to continuously update the ROI based on a user's input on the front panel, then mask the image and find the centroid of the area inside the ROI.
Requirements
Software
- LabVIEW 2012 Base Development System (or compatible)
- NI Vision Development Module 2012 (or compatible)
- NI-IMAQdx 4.0 (or compatible)
Hardware
- NI-IMAQdx driver supports the following buses and standards:
Gigabit Ethernet Cameras Supporting GigE Vision, FireWire IEEE 1394 Cameras, USB 2.0 Cameras Supporting Microsoft DirectShow (often called 'webcam'), USB 3.0 Cameras Supporting USB3 Vision
Steps to Implement or Execute Code
- Open the attached file
- Select the camera name
- Run the VI
- Select a ROI tool and draw a new Region of Interest (ROI)
Additional Information or References


KnowledgeBase: What Is the Difference Between NI-IMAQ, NI-IMAQdx, and NI-IMAQ I/O?
http://digital.ni.com/public.nsf/allkb/0564022DAFF513D2862579490057D42E
**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.**
Zach C.
Field Engineer
Greater Los Angeles