Example Code

Adaptive Thresholding in IMAQ Vision

Code and Documents



The adaptive thresholding approach allows the user to extract relevant information information from images under broad variations in lighting conditions.



For Machine Vision users who are challenged by non-uniform or changing lighting conditions, the Adaptive Thresholding algorithm is an image segmentation tool that is both powerful and flexible. 


Hardware and Software Requirements

LabVIEW 2014 or compatible

Vision Development Module 2014 or compatible


Steps to Implement or Execute Code

  1. Download the zip file attached below and extract the files to a known location
  2. Open the Adaptive Threshold (Main).vi
  3. Select an image (you can use the one provided in the zip file)
  4. Select the Filter Size
  5. Run this VI
  6. Select a Region Of Interest (ROI)
  7. The left image shows the Original Image and the balanced ROI image overlaid on it
  8. The right image shows the selected ROI correctly thresholded. 


Additional Information or References


Front Panel:

Front Panel.PNG



Alyssa H.

Applications Engineer

National Instruments


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