Public Member Functions | |
| str | __str__ (self) |
| Return a human-readable string of the PixelFormat object. | |
| str | __repr__ (self) |
| Return an unambiguous string of the PixelFormat object. | |
| Union[int, float] | minimum_value_per_channel (self) |
| Returns the minimum possible value per channel for the pixel format. | |
| Union[int, float] | maximum_value_per_channel (self) |
| Returns the maximum possible value per channel for the pixel format. | |
| int | storage_bits_per_channel (self) |
| Returns the number of bits used per channel for storage. | |
| int | storage_bits_per_pixel (self) |
| Returns the total number of bits used per pixel for storage. | |
| str | string_value (self) |
| Returns the human-readable name of the pixel format. | |
| Tuple[Channel,...] | channels (self) |
| Returns the list of channels in the pixel format. | |
| int | allocated_bits_per_pixel (self) |
| Returns the number of allocated bits per pixel. | |
| str | numpy_dtype (self) |
| Returns the numpy dtype string for this pixel format. | |
| bool | has_intensity_channel (self) |
| Returns True if the pixel format has an intensity channel. | |
| int | number_of_channels (self) |
| Returns the total number of channels in the pixel format. | |
| bool | is_single_channel (self) |
| Returns True if the pixel format has only a single channel. | |
| bool | is_packed (self) |
| Returns True if the pixel format is packed. | |
| bool | is_interleaved (self) |
| Indicates whether the pixel format is interleaved. | |
| PixelFormat | unpacked_format (self) |
| Returns the unpacked pixel format for a packed pixel format. | |
| int | get_channel_index (self, Channel channel) |
| Returns the index of a specific channel within the pixel format. | |
| bool | has_channel (self, Channel channel) |
| Returns True if the pixel format has a specific channel. | |
| int | get_size_in_bytes (self, Size size) |
| Calculates the memory size in bytes for a given image size. | |
| bool | is_float (self) |
Static Public Member Functions | |
| PixelFormat | create_from_string_value (str string_value) |
Data Fields | |
| is_float | |
| channels | |
Protected Member Functions | |
| _PixelFormatMetadata | _metadata (self) |
Enum listing all supported pixel formats and their internal IDs.
Each enumerator represents a specific pixel layout and bit depth, used for interpreting raw image data correctly.
This class also offers methods to query characteristics of specific pixel formats, such as value ranges, storage sizes, and channel configurations.
Definition at line 97 of file pixelformat.py.
| str __repr__ | ( | self | ) |
Return an unambiguous string of the PixelFormat object.
Definition at line 273 of file pixelformat.py.
| str __str__ | ( | self | ) |
Return a human-readable string of the PixelFormat object.
Definition at line 266 of file pixelformat.py.
|
protected |
Definition at line 461 of file pixelformat.py.
| int allocated_bits_per_pixel | ( | self | ) |
Returns the number of allocated bits per pixel.
Definition at line 335 of file pixelformat.py.
| Tuple[Channel, ...] channels | ( | self | ) |
Returns the list of channels in the pixel format.
Definition at line 327 of file pixelformat.py.
|
static |
Definition at line 259 of file pixelformat.py.
| int get_channel_index | ( | self, | |
| Channel | channel ) |
Returns the index of a specific channel within the pixel format.
Definition at line 438 of file pixelformat.py.
| int get_size_in_bytes | ( | self, | |
| Size | size ) |
Calculates the memory size in bytes for a given image size.
Definition at line 452 of file pixelformat.py.
| bool has_channel | ( | self, | |
| Channel | channel ) |
Returns True if the pixel format has a specific channel.
Definition at line 445 of file pixelformat.py.
| bool has_intensity_channel | ( | self | ) |
Returns True if the pixel format has an intensity channel.
Definition at line 351 of file pixelformat.py.
| bool is_float | ( | self | ) |
Definition at line 465 of file pixelformat.py.
| bool is_interleaved | ( | self | ) |
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 | ...
Returns: bool: True if the pixel format is interleaved, otherwise False.
Definition at line 383 of file pixelformat.py.
| bool is_packed | ( | self | ) |
Returns True if the pixel format is packed.
Definition at line 375 of file pixelformat.py.
| bool is_single_channel | ( | self | ) |
Returns True if the pixel format has only a single channel.
Definition at line 367 of file pixelformat.py.
| Union[int, float] maximum_value_per_channel | ( | self | ) |
Returns the maximum possible value per channel for the pixel format.
Definition at line 292 of file pixelformat.py.
| Union[int, float] minimum_value_per_channel | ( | self | ) |
Returns the minimum possible value per channel for the pixel format.
Definition at line 281 of file pixelformat.py.
| int number_of_channels | ( | self | ) |
Returns the total number of channels in the pixel format.
Definition at line 359 of file pixelformat.py.
| str numpy_dtype | ( | self | ) |
Returns the numpy dtype string for this pixel format.
Definition at line 343 of file pixelformat.py.
| int storage_bits_per_channel | ( | self | ) |
Returns the number of bits used per channel for storage.
Definition at line 303 of file pixelformat.py.
| int storage_bits_per_pixel | ( | self | ) |
Returns the total number of bits used per pixel for storage.
Definition at line 311 of file pixelformat.py.
| str string_value | ( | self | ) |
Returns the human-readable name of the pixel format.
Definition at line 319 of file pixelformat.py.
| PixelFormat unpacked_format | ( | self | ) |
Returns the unpacked pixel format for a packed pixel format.
If the pixel format is already unpacked, the same format is returned.
Definition at line 429 of file pixelformat.py.
|
static |
Definition at line 124 of file pixelformat.py.
|
static |
Definition at line 241 of file pixelformat.py.
|
static |
Definition at line 183 of file pixelformat.py.
|
static |
Definition at line 198 of file pixelformat.py.
|
static |
Definition at line 213 of file pixelformat.py.
|
static |
Definition at line 162 of file pixelformat.py.
|
static |
Definition at line 223 of file pixelformat.py.
|
static |
Definition at line 125 of file pixelformat.py.
|
static |
Definition at line 246 of file pixelformat.py.
|
static |
Definition at line 188 of file pixelformat.py.
|
static |
Definition at line 203 of file pixelformat.py.
|
static |
Definition at line 218 of file pixelformat.py.
|
static |
Definition at line 163 of file pixelformat.py.
|
static |
Definition at line 228 of file pixelformat.py.
|
static |
Definition at line 123 of file pixelformat.py.
|
static |
Definition at line 251 of file pixelformat.py.
|
static |
Definition at line 208 of file pixelformat.py.
|
static |
Definition at line 120 of file pixelformat.py.
|
static |
Definition at line 243 of file pixelformat.py.
|
static |
Definition at line 181 of file pixelformat.py.
|
static |
Definition at line 200 of file pixelformat.py.
|
static |
Definition at line 215 of file pixelformat.py.
|
static |
Definition at line 165 of file pixelformat.py.
|
static |
Definition at line 225 of file pixelformat.py.
|
static |
Definition at line 121 of file pixelformat.py.
|
static |
Definition at line 248 of file pixelformat.py.
|
static |
Definition at line 186 of file pixelformat.py.
|
static |
Definition at line 205 of file pixelformat.py.
|
static |
Definition at line 220 of file pixelformat.py.
|
static |
Definition at line 166 of file pixelformat.py.
|
static |
Definition at line 230 of file pixelformat.py.
|
static |
Definition at line 119 of file pixelformat.py.
|
static |
Definition at line 253 of file pixelformat.py.
|
static |
Definition at line 210 of file pixelformat.py.
|
static |
Definition at line 112 of file pixelformat.py.
|
static |
Definition at line 242 of file pixelformat.py.
|
static |
Definition at line 182 of file pixelformat.py.
|
static |
Definition at line 199 of file pixelformat.py.
|
static |
Definition at line 214 of file pixelformat.py.
|
static |
Definition at line 168 of file pixelformat.py.
|
static |
Definition at line 224 of file pixelformat.py.
|
static |
Definition at line 113 of file pixelformat.py.
|
static |
Definition at line 247 of file pixelformat.py.
|
static |
Definition at line 187 of file pixelformat.py.
|
static |
Definition at line 204 of file pixelformat.py.
|
static |
Definition at line 219 of file pixelformat.py.
|
static |
Definition at line 169 of file pixelformat.py.
|
static |
Definition at line 229 of file pixelformat.py.
|
static |
Definition at line 111 of file pixelformat.py.
|
static |
Definition at line 252 of file pixelformat.py.
|
static |
Definition at line 209 of file pixelformat.py.
|
static |
Definition at line 116 of file pixelformat.py.
|
static |
Definition at line 240 of file pixelformat.py.
|
static |
Definition at line 180 of file pixelformat.py.
|
static |
Definition at line 197 of file pixelformat.py.
|
static |
Definition at line 212 of file pixelformat.py.
|
static |
Definition at line 171 of file pixelformat.py.
|
static |
Definition at line 222 of file pixelformat.py.
|
static |
Definition at line 117 of file pixelformat.py.
|
static |
Definition at line 245 of file pixelformat.py.
|
static |
Definition at line 185 of file pixelformat.py.
|
static |
Definition at line 202 of file pixelformat.py.
|
static |
Definition at line 217 of file pixelformat.py.
|
static |
Definition at line 172 of file pixelformat.py.
|
static |
Definition at line 227 of file pixelformat.py.
|
static |
Definition at line 115 of file pixelformat.py.
|
static |
Definition at line 250 of file pixelformat.py.
|
static |
Definition at line 207 of file pixelformat.py.
|
static |
Definition at line 151 of file pixelformat.py.
|
static |
Definition at line 178 of file pixelformat.py.
|
static |
Definition at line 152 of file pixelformat.py.
|
static |
Definition at line 150 of file pixelformat.py.
|
static |
Definition at line 159 of file pixelformat.py.
|
static |
Definition at line 160 of file pixelformat.py.
|
static |
Definition at line 158 of file pixelformat.py.
| channels |
Definition at line 364 of file pixelformat.py.
|
static |
Definition at line 133 of file pixelformat.py.
|
static |
Definition at line 132 of file pixelformat.py.
|
static |
Definition at line 139 of file pixelformat.py.
|
static |
Definition at line 136 of file pixelformat.py.
|
static |
Definition at line 137 of file pixelformat.py.
|
static |
Definition at line 135 of file pixelformat.py.
| is_float |
Definition at line 286 of file pixelformat.py.
|
static |
Definition at line 128 of file pixelformat.py.
|
static |
Definition at line 239 of file pixelformat.py.
|
static |
Definition at line 255 of file pixelformat.py.
|
static |
Definition at line 190 of file pixelformat.py.
|
static |
Definition at line 196 of file pixelformat.py.
|
static |
Definition at line 236 of file pixelformat.py.
|
static |
Definition at line 211 of file pixelformat.py.
|
static |
Definition at line 232 of file pixelformat.py.
|
static |
Definition at line 174 of file pixelformat.py.
|
static |
Definition at line 221 of file pixelformat.py.
|
static |
Definition at line 234 of file pixelformat.py.
|
static |
Definition at line 129 of file pixelformat.py.
|
static |
Definition at line 244 of file pixelformat.py.
|
static |
Definition at line 256 of file pixelformat.py.
|
static |
Definition at line 191 of file pixelformat.py.
|
static |
Definition at line 201 of file pixelformat.py.
|
static |
Definition at line 237 of file pixelformat.py.
|
static |
Definition at line 216 of file pixelformat.py.
|
static |
Definition at line 233 of file pixelformat.py.
|
static |
Definition at line 175 of file pixelformat.py.
|
static |
Definition at line 226 of file pixelformat.py.
|
static |
Definition at line 235 of file pixelformat.py.
|
static |
Definition at line 130 of file pixelformat.py.
|
static |
Definition at line 193 of file pixelformat.py.
|
static |
Definition at line 127 of file pixelformat.py.
|
static |
Definition at line 249 of file pixelformat.py.
|
static |
Definition at line 254 of file pixelformat.py.
|
static |
Definition at line 206 of file pixelformat.py.
|
static |
Definition at line 231 of file pixelformat.py.
|
static |
Definition at line 147 of file pixelformat.py.
|
static |
Definition at line 177 of file pixelformat.py.
|
static |
Definition at line 148 of file pixelformat.py.
|
static |
Definition at line 194 of file pixelformat.py.
|
static |
Definition at line 146 of file pixelformat.py.
|
static |
Definition at line 155 of file pixelformat.py.
|
static |
Definition at line 156 of file pixelformat.py.
|
static |
Definition at line 154 of file pixelformat.py.
|
static |
Definition at line 141 of file pixelformat.py.
|
static |
Definition at line 142 of file pixelformat.py.
|
static |
Definition at line 144 of file pixelformat.py.