Common Vision Blox 15.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Friends Modules Pages
Pixel Format Conversion - PFNC Formats and Bayer Conversion

PFNC Formats

The Pixel Format Naming Convention (PFNC) is a standardized scheme used in machine vision to name and describe pixel formats. It covers both 2D and 3D imaging data.

CVB follows this convention and provides convenient tools for converting between formats using the Cvb::PixelFormatConverter (C++), Stemmer.Cvb.PixelFormatConverter (.NET), and cvb.PixelFormatConverter (Python). Please note that while most formats are supported for conversion, they can only be converted to commonly used (displayable) formats.

For more general information about PFNC, refer to the official documentation.

Bayer Conversion

Bayer conversion is the process of transforming raw image data from a camera sensor that uses a Bayer filter into a full-color RGB image. Each pixel in the raw Bayer image records only one color (red, green, or blue), and the missing color values are estimated through a process called demosaicing, which reconstructs the complete color information for each pixel.

G R G R G R G R
B G B G B G B G
G R G R G R G R
B G B G B G B G
G R G R G R G R
B G B G B G B G
RGB RGB RGB RGB
RGB RGB RGB RGB
RGB RGB RGB RGB

With CVB, performing a Bayer-to-RGB conversion is straightforward using the Cvb::PixelFormatConverter (C++), Stemmer.Cvb.PixelFormatConverter (.NET), and cvb.PixelFormatConverter (Python). Example programs for Bayer conversion are provided in the section below.

Examples

Note
To view a CVB image as a PFNC buffer see the following example: Reinterpreting Images as PFNC Buffer (available for C++ and .NET).

Example programs for PFNC format conversion, such as a Bayer conversion, are provided in C++, .NET and, Python. You can find them in your CVB setup under %cvb%Tutorial/Image Manager or in the online documentation, as listed in the table below:

Link to Example Location in your CVB Setup
C++ PixelFormatConversion %cvb%Tutorial/Image Manager/Cvb++/CppPixelFormatConversion
.NET PixelFormatConversion %cvb%Tutorial/Image Manager/Cvb.Net/PixelFormatConversion
Python PixelFormatConversion %cvb%Tutorial/Image Manager/CVBpy/PixelFormatConversion