From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Convert YCbCr RAW File to BMP or PNG without RGB Colorspace Transformation

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
This example allows the user transfer a RAW file that uses the YCbCr colorspace to BMP or PNG file without   RGB  color space transformation. 

 

Description
These two VIs will perform a lossless conversion of a RAW file with YCbCr colorspace to a BMP or PNG file without an RGB colorspace transformation. Users need to keep in mind that converting to an RGB file format like BMP or PNG without converting the colorspace will result in a color bar that does not look "normal" due to the different color space. The results of a color bar test in VideoMASTER or NI VMS will reflect this, so users must adjust the limits of your test accordingly. To run the attached code, you must select the file path to your .raw file, the video format (standard or high definition), and the number of lines in the image.

 

Requirements

  1. LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer
  2. Choose RAW File to BMP File No Color Space Transformation 2012 NIVerified.vi or RAW File to PNG File No RGB Color Space Transformation 2012 NIVerified.vi based on user’s need.
  3. Select the file path to your .raw file, the video format (standard or high definition) and the number of lines in the image.
  4. Run the application.

 

Additional Information or References

Lack of .raw file will result in an error. User need to provide right .raw file path before run the application.

VI Snippet

RAW File to BMP File No Color Space Transformation 2012 NIVerified.vi
RAW File to BMP File No Color Space Transformation 2012 NIVerified.png

RAW File to PNG File No RGB Color Space Transformation 2012 NIVerified.vi

RAW File to PNG File No RGB Color Space Transformation 2012 NIVerified.png

 

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

 

 

 

 

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