libcamera v0.3.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
libcamera::BayerFormat Class Reference

Class to represent a raw image Bayer format. More...

## Public Types
enum | Order : uint8_t { BGGR = 0 , GBRG = 1 , GRBG = 2 , RGGB = 3 , MONO = 4 }
| The order of the colour channels in the Bayer pattern. More...
enum class | Packing : uint16_t { None = 0 , CSI2 = 1 , IPU3 = 2 , PISP1 = 3 , PISP2 = 4 }
| Different types of packing that can be applied to a BayerFormat. More...

## Public Member Functions
constexpr | BayerFormat ()
| Construct an empty (and invalid) BayerFormat.
constexpr | BayerFormat (Order o, uint8_t b, Packing p)
| Construct a BayerFormat from explicit values.
bool | isValid () const
| Return whether a BayerFormat is valid.
std::string | toString () const
| Assemble and return a readable string representation of the BayerFormat.
V4L2PixelFormat | toV4L2PixelFormat () const
| Convert a BayerFormat into the corresponding V4L2PixelFormat.
PixelFormat | toPixelFormat () const
| Convert a BayerFormat into the corresponding PixelFormat.
BayerFormat | transform (Transform t) const
| Apply a transform to this BayerFormat.

## Static Public Member Functions
static const BayerFormat & | fromMbusCode (unsigned int mbusCode)
| Retrieve the BayerFormat associated with a media bus code.
static BayerFormat | fromV4L2PixelFormat (V4L2PixelFormat v4l2Format)
| Convert v4l2Format to the corresponding BayerFormat.
static BayerFormat | fromPixelFormat (PixelFormat format)
| Convert a PixelFormat into the corresponding BayerFormat.

## Public Attributes
Order | order
| The order of the colour channels in the Bayer pattern.
uint8_t | bitDepth
| The bit depth of the samples in the Bayer pattern.
Packing | packing
| Any packing scheme applied to this BayerFormat.

## Detailed Description

Class to represent a raw image Bayer format.

This class encodes the different Bayer formats in such a way that they can be easily manipulated. For example, the bit depth or Bayer order can be easily altered - the Bayer order can even be "transformed" in the same manner as happens in many sensors when their horizontal or vertical "flip" controls are set.

## Member Enumeration Documentation

## ◆ Order

enum libcamera::BayerFormat::Order : uint8_t

The order of the colour channels in the Bayer pattern.

Enumerator
BGGR | B then G on the first row, G then R on the second row.
GBRG | G then B on the first row, R then G on the second row.
GRBG | G then R on the first row, B then G on the second row.
RGGB | R then G on the first row, G then B on the second row.
MONO | Monochrome image data, there is no colour filter array.

## ◆ Packing

enum class libcamera::BayerFormat::Packing : uint16_t
| strong

Different types of packing that can be applied to a BayerFormat.

Enumerator
None | No packing.
CSI2 | Format uses MIPI CSI-2 style packing.
IPU3 | Format uses IPU3 style packing.
PISP1 | Format uses PISP mode 1 compression.
PISP2 | Format uses PISP mode 2 compression.

## Constructor & Destructor Documentation

## ◆ BayerFormat()

libcamera::BayerFormat::BayerFormat | ( | Order | o,
|  | uint8_t | b,
|  | Packing | p )
| inline constexpr

Construct a BayerFormat from explicit values.

Parameters

  [in] | o | The order of the Bayer pattern
  [in] | b | The bit depth of the Bayer samples
  [in] | p | The type of packing applied to the pixel values

## Member Function Documentation

## ◆ fromMbusCode()

const BayerFormat & libcamera::BayerFormat::fromMbusCode | ( | unsigned int | mbusCode | ) |
| static

Retrieve the BayerFormat associated with a media bus code.

Parameters

  [in] | mbusCode | The media bus code to convert into a BayerFormat

The media bus code numeric identifiers are defined by the V4L2 specification.

## ◆ fromPixelFormat()

BayerFormat libcamera::BayerFormat::fromPixelFormat | ( | PixelFormat | format | ) |
| static

Convert a PixelFormat into the corresponding BayerFormat.

Returns
  The BayerFormat corresponding to this PixelFormat

## ◆ fromV4L2PixelFormat()

BayerFormat libcamera::BayerFormat::fromV4L2PixelFormat | ( | V4L2PixelFormat | v4l2Format | ) |
| static

Convert v4l2Format to the corresponding BayerFormat.

Parameters

  [in] | v4l2Format | The raw format to convert into a BayerFormat

Returns
  The BayerFormat corresponding to v4l2Format

## ◆ toPixelFormat()

PixelFormat libcamera::BayerFormat::toPixelFormat | ( |  | ) | const

Convert a BayerFormat into the corresponding PixelFormat.

Returns
  The PixelFormat corresponding to this BayerFormat

## ◆ toString()

std::string libcamera::BayerFormat::toString | ( |  | ) | const

Assemble and return a readable string representation of the BayerFormat.

Returns
  A string describing the BayerFormat

## ◆ toV4L2PixelFormat()

V4L2PixelFormat libcamera::BayerFormat::toV4L2PixelFormat | ( |  | ) | const

Convert a BayerFormat into the corresponding V4L2PixelFormat.

Returns
  The V4L2PixelFormat corresponding to this BayerFormat

## ◆ transform()

BayerFormat libcamera::BayerFormat::transform | ( | Transform | t | ) | const

Apply a transform to this BayerFormat.

Parameters

  [in] | t | The transform to apply

Applying a transform to an image stored in a Bayer format affects the Bayer order. For example, performing a horizontal flip on the Bayer pattern RGGB causes the RG rows of pixels to become GR, and the GB rows to become BG. The transformed image would have a GRBG order. Performing a vertical flip on the Bayer pattern RGGB causes the GB rows to come before the RG ones and the transformed image would have GBRG order. Applying both vertical and horizontal flips on the Bayer patter RGGB results in transformed images with BGGR order. The bit depth and modifiers are not affected.

Horizontal and vertical flips are applied before transpose.

Returns
  The transformed Bayer format

The documentation for this class was generated from the following files:

- include/libcamera/internal/bayer_format.h
- src/libcamera/bayer_format.cpp