Example Code

Overlay Thresholded Area with Color in RGB Image

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 threshold an IMAQ image and show the result as a mask in the image

 

Description

This example opens an image file, performs a threshold on it and shows the threshold result as a mask on the original image.

Requirements

 Software

  • LabVIEW Base Development System 2012 (or compatible)
  • NI Vision Development 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 file
  2. Run the program

 

Additional Information or References

Overlay Colored Threshold LV2012 NIVerified.vi - Front Panel.png

 

Overlay Colored Threshold LV2012 NIVerified.vi - Block Diagram.png

 

Note: If your taps are interlaced vertically, use Transpose 2D Array to rotate your image after IMAQ ImageToArray and use an additional Transpose 2D Array to rotate your image before the final IMAQ ArrayToImage.

 

For color images use IMAQ ColorImageToArray and IMAQ ArrayToColorImage in place of IMAQ ImageToArray and IMAQ ArrayToImage, respectively. Be sure to change the Image Type of IMAQ Create if your image is not 8-bit grayscale. IMAQ ColorImageToArray and IMAQ ArrayToColorImage are available in NI Vision Development Module.

 

Also see: Swap Taps Using IMAQ Interlace community example for another way to swap taps in LV.

 

**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.**

Vivek Nath
National Instruments
Applications Engineer

Machine Vision

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