Programmatically Clear an Image Display Control

Updated Mar 16, 2023

Environment

Software

  • LabVIEW Full

Driver

  • NI-IMAQ

I am displaying an image in the LabVIEW image display control. How to programmatically clear the display?

The image display shows data that is present in an image buffer. There are two ways to programmatically clear the image display:

If you are using Snapshot mode:
To programmatically clear the image display control, write an image constant to a local variable of the image display control. To create the image constant, right-click on the image display terminal from the block diagram and select Create»Constant.
  • In LabVIEW 7.x, a dialog box will appear prompting you to select an image for the constant. Click Cancel to exit the dialog box without selecting an image file. An image constant will be created on the block diagram with a blank image.
  • In LabVIEW 8.x, a blank image constant will be created by default.  To create the local variable of the image display control, right-click on its icon on the block diagram and select Create»Local Variable. To clear the image display back to gray, wire the image constant to a local variable of the image display control.

If you are not using Snapshot mode:
The image display simply displays the information that is currently in the image buffer that is wired to the control. To clear the image display in this mode, you can either do the same thing as above, or you can simply destroy the image buffer using the IMAQ Dispose VI. This will clear the image display to a blank gray. You want to make sure that the image is displayed before the buffer is cleared, as doing both at the same time does not guarantee that you will see the image. For the user to be able to see the image, you must access it before you destroy it by Using IMAQ Dispose. This can be ensured with proper dataflow and execution order.

Additional Information

Further assistance can be found in the help documentation that is installed with NI-IMAQ. The document is saved by default to C:\Program Files\National Instruments\NI-IMAQ\Docs.