Example Code

Image Threshold

Code and Documents

Attachment

Download All

Overview

This example illustrates different image thresholding algorithms, Local, Automatic, and Manual. 

 

Description

Local thresholding calculates local statistics for each pixel in an image. Based on the calculation result, the algorithm categorizes the pixel as part of a particle or the background. Automatic thresholding uses the histogram of an image to compute a single threshold value for the entire image. Manual thresholding uses a specified range of values to compute a threshold value for the image. Refer to the NI Vision Concepts Manual for more information about thresholding algorithms.

 

Hardware and Software Requirements

LabVIEW 2014 or compatible

Vision Development Module 2014 or compatible

 

Steps to Implement or Execute Code

  1. Download both Image Threshold.vi and IMAQ Vision Example folder.vi, or find the example by going to Help >> Find Examples >> Toolkits and Modules >> Vision >> Image Processing, and find Image Threshold.vi
  2. Run the Image Threshold.vi
  3. Click on the different Threshold algorithm tabs to see how each algorithm works. The local threshold is the most robust algorithm when there are lighting variations in the image.

 

Additional Information or References

 

Front Panel:

Front Panel.PNG

 

Alyssa H.

Applications Engineering 

National Instruments

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

Contributors