Example Code

LabVIEW IMAQ Image to CSV file for editing in Excel

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 extract the three color planes (red, green, blue) from an image and save the planes as CVS file.

 

Description

It is sometimes desired to process an image in another application like Excel. To do so, you need to convert the image from png/jpg/bmp and so on into a format which can be easily processed by Excel. The CSV file format is one format which can be used for this purpose.

This example demonstrates how to use the functions shipped with the Vision Development Module (VDM) to extract a red, green and blue color plane from an image and how to save the planes as CSV file.

 

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 the VI and follow the instructions inside

 

Additional Information or References

Save Color Planes As CSV File - Front Panel.png

 

Save Color Planes As CSV File - Block Diagram.png

 

Once the CSV file is opened in Excel, you can determine where the Green plane's 2D array begins by counting the number of columns.  The number of columns will be equal to the width of the image.

 

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

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