Example Code

Convert a Grayscale Image into a Binary Image with VDM

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Vision Development Module
  • LabVIEW

Code and Documents

Attachment

Overview

This example demonstrates how to convert a grayscale image into a binary image with the IMAQ Threshold VI.

 

Description

Some of the image processing functions are only meant to input binary images. However, if you image is not binary, you will have to convert it to utilize these functions. To do this, use an IMAQ Thershold (instead of IMAQ Cast) with a range value of 0,1. Then, ensure to change your palette on your Image Display to "Binary" to properly view the image.

 

Requirements

 Software

  • LabVIEW Base Development System 2012 (or compatible)
  • NI Vision Development Module 2012 (or compatible)
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached ZIP-file
  2. Open and run the VI

 

Additional Information or References

Convert Grayscale Image to Binary Image LV2012 NIVerified - Front Panel.png

 

Convert Grayscale Image to Binary Image - Block Diagram.png

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**
Marti C
Applications Engineer
National Instruments
NI Medical

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