Example Code

Correlated Color Temperature Example Using LabVIEW

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

  • LabVIEW

Code and Documents

Attachment

 

Overview
Correlated Color Temperature (CCT) is a measurement of the color of light produced by a light source. It is the temperature of an ideal black body radiator that radiates light of comparable hue to a light source. Note: a blackbody radiator is an idealization that represents an object that absorbs all incident electromagnetic radiation.


Description
The following example provides a method for converting RGB U32 image pixel values to the CIE 1960 u,v color space, which is frequently used to calculate the CCT. The application then finds the average u and v chromaticity values, which when used in conjunction with the CIE 1960 UCS (Uniform Color Space) diagram, can calculate the correlated color temperature. The subVIs in this application can also be used a reference for converting image to the CIE 1931 x,y chromaticity color space and CIE 1960 u,v chromaticity color space.

 
Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Open the project and “Correlated Color Temperature.vi ”
  2. Select a saved image using the Image Location path control
  3. Run the VI
  4. Using the u Average and v Average values computes, use the CIE 1960 UCS diagram displayed to calculate the Color Temperature in Kelvin
  5. The Kelvin Color Temperature scale is included on the right to aid with mapping the Color Temperature to the light source

Additional Information or References
VI Block Diagram

 5-326.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

 

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments

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