Common Questions and Issues with the IMAQ Overlay Functions

Updated Oct 17, 2022

Reported In


  • Camera


  • Vision Development Module


  • NI-IMAQdx

Issue Details

How do I use the IMAQ Overlay Functions? What are some common questions and issues with these functions?


A nondestructive overlay enables you to annotate the display of an image with useful information without actually modifying the image. You can overlay text, lines, points, complex geometric shapes, and bitmaps on top of your image without changing the underlying pixel values in your image; only the display of the image is affected.

The following are the frequently asked questions about IMAQ Overlay functions:

Difference between the IMAQ Draw and the IMAQ Overlay VIs:
The IMAQ Overlay VIs display certain shapes and colors on top of an image, but can only be used for display purposes. The IMAQ Draw VIs actually replace pixels of an image with the pixel values of the shape you wish to draw.. If you would like to make your IMAQ Overlays permanent, follow the links below and look at the overlay example programs linked below.

How to use IMAQ 1394 Grab:
The IMAQ does erase the overlays when you are using a PCI/PXI frame grabber. The IMAQ 1394 Grab does not; however, this can be remedied by simply adding in the IMAQ Clear into the loop before the IMAQ1394 Grab

Modifying text appearing on the CVS:
During vision inspection, several overlay functions can be called to place shapes and text over the images on the monitor. By default the text appears very small.  The font, size, and style inputs to the Overlay Function seem to have no effect. These inputs work correctly if I run the program on my development computer, but not on the CVS. How do we modify the text appearing on the CVS?

Because the CVS is running a small, real-time operating system, it does not have all of the features available to it that a normal Windows machine does. Only one font will exist on the CVS and the real-time operating system, and therefore we do not have all of the options for selecting various fonts, styles, and sizes that exist when we run an example in Windows. 

The font is actually located in a single image file, font.png, on the CVS. If you download this file from the CVS (it is located in the vision folder), then you can open it and view the font on your computer. This file will contain the standard font that will appear on the CVS. If you modify one of the letters in this font.png file, then you can change how the letters will appear on the CVS screen. Once you have made the changes, simply copy the file back to its original location on the CVS and reboot the system. While this will let you experiment with some minor changes, you are still limited in the appearance of the text on the CVS. 

How to use Merge Overlay:
If you have a 10-bit image that you are attempting to merge with a text overlay, this works fine if the image is acquired as an 8-bit image. However, if you try to acquire the image as a 10-bit image, copy it, and merge the overlay into the copy, the intensities of all pixels are increased significantly, making the text illegible. This problem repeats if you try to cast the image into 8-bits as well. In order to get a detailed and increased resolution of the 10-bit image, you should use the IMAQ Image Bit Depth function to specify the bit-depth of the new copy of the image. Use this function and specify a bit-depth of 10, and then use the Overlay Text and Merge Overlay functions to create your new image.

Vision Functions that Overlay Information on an Image:
Every time information is overlaid on an image that is in memory, the overlay information gets added to the same buffer that holds the image information. As a result, if this function is called in a loop, every time the loop iterates, new overlay information will be added to the buffer. This will show up as linearly increasing memory usage while the loop continues to iterate. The list below includes some of the functions that will cause the above described behavior:

IMAQ Copy Overlay
IMAQ Overlay Arc
IMAQ Overlay Closed Contour
IMAQ Overlay Line
IMAQ Overlay Metafile
IMAQ Overlay Open Contour
IMAQ Overlay Oval
IMAQ Overlay Points
IMAQ Overlay Rect
IMAQ Overlay ROI
IMAQ Overlay Text

Proper use of these functions requires the disposal of the overlay information from the image in order to keep the memory usage under control. All the overlay information associated with an image can be disposed of by calling the IMAQ Clear Overlay function. IMAQ Dispose also cleans up all resources associated with images (including overlays, regions of interest, arrays, reports, and the image itself) that you no longer need.

Displaying an Image with Overlays Without Purchasing NI-Vision:
With LabVIEW 7.0 and later, images can be embedded on the front panel with the image display control. With the new image display, the user can draw regions of interest (ROI's) on the image with the ROI toolbox, without the need for NI-Vision. If you need to add crosshairs, lines, rectangles, or oval overlays to your image, you can programmatically draw ROIs on the image using property nodes in your LabVIEW code. These ROIs will not affect the actual image values, so they will work just like overlays. 

Using Overlay functions with a third-party viewer:
When using the IMAQ Overlay functions, a third-party viewer will not display this information. You must use the Read Image Vision Info with application software to view the overlay. To display an overlay in a third-party viewer, you can use the IMAQ Merge, which is a destructive function, meaning that it replaces the underlying pixels with the overlaid pixels.

Adding color information onto a grayscale image:
Overlays allow the addition of color information over a grayscale image, in a non-destructive manner. For destructive operations, the Draw VIs can be used, which actually overwrite the image with the overlays. For examples of using the overlay functions, navigate to <LabVIEW>\examples\Vision\Overlay Utilities.