Provides information and utility functions for pixel formats. More...
#include <peak_common/types/peak_common_pixel_format.hpp>
Public Member Functions | |
| PixelFormatInfo (peak::common::PixelFormat pixelFormat) | |
| Constructs a PixelFormatInfo object for the specified pixel format. | |
| PixelFormatInfo (const std::string &name) | |
| Constructs a PixelFormatInfo object from the name of a pixel format. | |
| template<typename T = size_t> | |
| PEAK_COMMON_NO_DISCARD T | GetMinimumValuePerChannel () const |
| Returns the minimum possible value per channel for the pixel format. | |
| template<typename T = size_t> | |
| PEAK_COMMON_NO_DISCARD T | GetMaximumValuePerChannel () const |
| Returns the maximum possible value per channel for the pixel format. | |
| PEAK_COMMON_NO_DISCARD size_t | GetStorageBitsPerPixel () const |
| Returns the total number of bits used per pixel for storage. | |
| PEAK_COMMON_NO_DISCARD size_t | GetStorageBitsPerChannel () const |
| Returns the number of bits used per channel for storage. | |
| PEAK_COMMON_NO_DISCARD std::string | GetName () const |
| Returns the human-readable name of the pixel format. | |
| PEAK_COMMON_NO_DISCARD std::vector< Channel > | GetChannels () const |
| Returns the list of channels in the pixel format. | |
| PEAK_COMMON_NO_DISCARD size_t | GetAllocatedBitsPerPixel () const |
| Returns the number of allocated bits per pixel. | |
| PEAK_COMMON_NO_DISCARD bool | HasIntensityChannel () const |
| Checks whether the pixel format includes an intensity channel. | |
| PEAK_COMMON_NO_DISCARD size_t | GetChannelIndex (Channel channel) const |
| Returns the index of a specific channel within the pixel format. | |
| PEAK_COMMON_NO_DISCARD size_t | GetNumberOfChannels () const |
| Returns the total number of channels in the pixel format. | |
| PEAK_COMMON_NO_DISCARD bool | IsSingleChannel () const |
| Checks whether the pixel format contains only a single channel. | |
| PEAK_COMMON_NO_DISCARD bool | HasChannel (Channel channel) const |
| Checks whether a specific channel is present in the pixel format. | |
| PEAK_COMMON_NO_DISCARD peak::common::PixelFormat | GetPixelFormat () const |
| Returns the underlying pixel format enumeration value. | |
| PEAK_COMMON_NO_DISCARD size_t | GetSizeInBytes (const Size &size) const |
| Calculates the memory size in bytes for a given image size. | |
| PEAK_COMMON_NO_DISCARD bool | IsPacked () const |
| Returns whether the pixel format is packed. | |
| PEAK_COMMON_NO_DISCARD bool | IsInterleaved () const |
| Indicates whether the pixel format is interleaved. | |
| PEAK_COMMON_NO_DISCARD bool | IsFloat () const |
| Returns whether the pixel format uses floating points. | |
| PEAK_COMMON_NO_DISCARD PixelFormat | GetUnpackedPixelFormat () const |
| Returns the unpacked pixel format for a packed pixel format. | |
| template<typename T> | |
| T | GetMinimumValuePerChannel () const |
| template<typename T> | |
| T | GetMaximumValuePerChannel () const |
| template<> | |
| size_t | GetMinimumValuePerChannel () const |
| template<> | |
| float | GetMinimumValuePerChannel () const |
| template<> | |
| size_t | GetMaximumValuePerChannel () const |
| template<> | |
| float | GetMaximumValuePerChannel () const |
Provides information and utility functions for pixel formats.
The PixelFormatInfo class offers methods to query characteristics of specific pixel formats, such as value ranges, storage sizes, and channel configurations.
|
inlineexplicit |
Constructs a PixelFormatInfo object for the specified pixel format.
| pixelFormat | The pixel format to describe. |
|
inlineexplicit |
Constructs a PixelFormatInfo object from the name of a pixel format.
| name | The name of the pixel format. |
|
inline |
Returns the number of allocated bits per pixel.
|
inline |
Returns the index of a specific channel within the pixel format.
| channel | The channel to locate. |
|
inline |
Returns the list of channels in the pixel format.
| T peak::common::PixelFormatInfo::GetMaximumValuePerChannel | ( | ) | const |
|
inline |
|
inline |
| PEAK_COMMON_NO_DISCARD T peak::common::PixelFormatInfo::GetMaximumValuePerChannel | ( | ) | const |
Returns the maximum possible value per channel for the pixel format.
| T | The value type (default is size_t). |
| T peak::common::PixelFormatInfo::GetMinimumValuePerChannel | ( | ) | const |
|
inline |
|
inline |
| PEAK_COMMON_NO_DISCARD T peak::common::PixelFormatInfo::GetMinimumValuePerChannel | ( | ) | const |
Returns the minimum possible value per channel for the pixel format.
| T | The value type (default is size_t). |
|
inline |
Returns the human-readable name of the pixel format.
|
inline |
Returns the total number of channels in the pixel format.
|
inline |
Returns the underlying pixel format enumeration value.
|
inline |
Calculates the memory size in bytes for a given image size.
| size | The size of the image. |
|
inline |
Returns the number of bits used per channel for storage.
|
inline |
Returns the total number of bits used per pixel for storage.
|
inline |
Returns the unpacked pixel format for a packed pixel format.
If the pixel format is already unpacked, the same format is returned.
|
inline |
Checks whether a specific channel is present in the pixel format.
| channel | The channel to check for. |
|
inline |
Checks whether the pixel format includes an intensity channel.
|
inline |
Returns whether the pixel format uses floating points.
|
inline |
Indicates whether the pixel format is interleaved.
Interleaved pixel formats arrange multiple image streams in memory using different patterns. The exact interleaving strategy depends on the pixel format family:
Mono*_A_B Images A and B alternate by row:
Memory row 1: Image A (row 1) Memory row 2: Image B (row 1) Memory row 3: Image A (row 2) Memory row 4: Image B (row 2) ...
Bayer*_A_B Images A and B are grouped in pairs of rows:
Memory row 1: Image A (row 1) Memory row 2: Image A (row 2) Memory row 3: Image B (row 1) Memory row 4: Image B (row 2) Memory row 5: Image A (row 3) Memory row 6: Image A (row 4) Memory row 7: Image B (row 3) Memory row 8: Image B (row 4) ...
Mono*_AB_CD Four image streams (A, B, C, D) are interleaved within each row:
Memory row 1: | A | B | A | B | A | B | Memory row 2: | C | D | C | D | C | D | Memory row 3: | A | B | A | B | A | B | Memory row 4: | C | D | C | D | C | D | ...
|
inline |
Returns whether the pixel format is packed.
|
inline |
Checks whether the pixel format contains only a single channel.