Example Code

Color Threshold Using Vision Development Module for LabVIEW

Overview

 This example demonstrates how to use the IMAQ Color Threshold function to produce a binary image from a color image.

 

Description

The Color Threshold example shows you how to produce a binary image from a color image using either the RGB or HSL color threshold mode.  With either threshold mode, you can set the minimum and maximum thresholding for each of the respective components via controls on the front panel.  There are two example images provided in the example.

 

Hardware and Software Requirements

 Vision Development Module

 

Steps to Implement or Execute Code

  • Find the example under Help >> Find Examples >> Toolkit and Modules >> Vision >> Color >> Color Threshold.vi
  • Run the VI
  • Change the Test Image to use different images with the same threshold ranges
  • Adjust the sliders to change the threshold ranges. Notice that HSL is a better Threshold Color Mode to find specific colors with lighting variations 

Additional Information or References

 IMAQ Color Threshold VI Help Documentation:

http://zone.ni.com/reference/en-XX/help/370281AC-01/imaqvision/imaq_colorthreshold/

Color Threshold Example Front PanelColor Threshold Example Front Panel

Clemens | Technical Support Engineer | National Instruments

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

Contributors