libcamera v0.0.3
Supporting cameras in Linux since 2019
|
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 } |
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. More... | |
bool | isValid () const |
Return whether a BayerFormat is valid. | |
std::string | toString () const |
Assemble and return a readable string representation of the BayerFormat. More... | |
V4L2PixelFormat | toV4L2PixelFormat () const |
Convert a BayerFormat into the corresponding V4L2PixelFormat. More... | |
PixelFormat | toPixelFormat () const |
Convert a BayerFormat into the corresponding PixelFormat. More... | |
BayerFormat | transform (Transform t) const |
Apply a transform to this BayerFormat. More... | |
Static Public Member Functions | |
static const BayerFormat & | fromMbusCode (unsigned int mbusCode) |
Retrieve the BayerFormat associated with a media bus code. More... | |
static BayerFormat | fromV4L2PixelFormat (V4L2PixelFormat v4l2Format) |
Convert v4l2Format to the corresponding BayerFormat. More... | |
static BayerFormat | fromPixelFormat (PixelFormat format) |
Convert a PixelFormat into the corresponding BayerFormat. More... | |
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. | |
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.
enum libcamera::BayerFormat::Order : uint8_t |
The order of the colour channels in the Bayer pattern.
|
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. |
Construct a BayerFormat from explicit values.
[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 |
|
static |
Retrieve the BayerFormat associated with a media bus code.
[in] | mbusCode | The media bus code to convert into a BayerFormat |
The media bus code numeric identifiers are defined by the V4L2 specification.
|
static |
Convert a PixelFormat into the corresponding BayerFormat.
|
static |
Convert v4l2Format to the corresponding BayerFormat.
[in] | v4l2Format | The raw format to convert into a BayerFormat |
PixelFormat libcamera::BayerFormat::toPixelFormat | ( | ) | const |
Convert a BayerFormat into the corresponding PixelFormat.
std::string libcamera::BayerFormat::toString | ( | ) | const |
Assemble and return a readable string representation of the BayerFormat.
V4L2PixelFormat libcamera::BayerFormat::toV4L2PixelFormat | ( | ) | const |
Convert a BayerFormat into the corresponding V4L2PixelFormat.
BayerFormat libcamera::BayerFormat::transform | ( | Transform | t | ) | const |
Apply a transform to this BayerFormat.
[in] | t | The transform to apply |
Appplying 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. The bit depth and modifiers are not affected.
Horizontal and vertical flips are applied before transpose.