Extract Overlay Information From Image Using IMAQ Functions

Updated Oct 1, 2024

Environment

Software

  • LabVIEW
  • Vision Development Module

Driver

  • NI-IMAQ

This example demonstrates how to read the overlays that are applied to an image, save the Region Of Interest (ROI) with an image, read its properties, and restore the ROI information from the image later.
You will require the following software to be able to run the example code:
  • LabVIEW Base Development System 2012 (or compatible)
  • NI Vision Development Module 2012 (or compatible)
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2012 (or compatible)

  1. Download and open the attached file
  2. Open the VI and follow the instructions on the Front Pane
Extract overlay Front panel.png
The example can be modified depending on what information you want to extract.
This concept is not limited to the ROI information and can be used to store every kind of information.
Note that only the PNG file format provides the ability to store custom data. Conversion or editing of the image can destroy the custom data.

This VI demonstrates how to use custom data to read the overlay information. It stores the information for a Region of Interest (ROI), gets the ROI properties from the main image, and displays it with a Property Node.  Then, it flattens ROI to a string and saves it as a custom key on the image. For writing the custom data use the IMAQ Write Custom Data VI and for reading it use IMAQ Read Custom Data VI. After when you read this new image it unflattens the string and converts it to the ROI and shows the results. So with this example, you can save a ROI in a picture as custom data, load the new image, restore the custom data, and see the ROI information.