IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
pixelformat.py
Go to the documentation of this file.
1from __future__ import annotations
2
3from enum import Enum
4from typing import Tuple, Union, NamedTuple, cast
5
6from ids_peak_common._internal.constants import FLOAT32_MAX, FLOAT32_MIN
7from ids_peak_common.datatypes.geometry.size import Size
8from ids_peak_common.exceptions import NotSupportedException
9
10
11class Channel(Enum):
12 """!
13 @brief
14 Channels
15
16 @ingroup ids_peak_common_python_types
17 """
18
19 INTENSITY = 0,
20 """!
21 @brief
22 Luminance or grayscale intensity channel. Common in single-channel images.
23 """
24
25 RED = 1,
26 """!
27 @brief
28 Red color channel. May appear in various layouts (e.g., RGB, ARGB).
29 """
30
31 GREEN = 2,
32 """!
33 @brief
34 Green color channel. Commonly part of multichannel color formats.
35 """
36
37 BLUE = 3,
38 """!
39 @brief
40 Blue color channel. Present in formats like BGR, RGBA, etc.
41 """
42
43 ALPHA = 4,
44 """!
45 @brief
46 Alpha (opacity or transparency) channel. Often used for blending and masking.
47 """
48
49 X = 5,
50 """!
51 @brief
52 Represents the X coordinate channel (e.g., in point clouds).
53 """
54
55 Y = 6,
56 """!
57 @brief
58 Represents the Y coordinate channel (e.g., in point clouds).
59 """
60
61 Z = 7,
62 """!
63 @brief
64 Represents the Z coordinate channel (e.g., in point clouds).
65 """
66
67 BAYER = 8,
68 """!
69 @brief
70 Raw Bayer pattern data from image sensors (e.g., BGGR, RGGB).
71 """
72
73 CHROMA_U = 9,
74 """!
75 @brief
76 Chrominance U channel (Cb). Represents the blue-difference chroma component in YUV/YCbCr color spaces.
77 """
78
79 CHROMA_V = 10
80 """!
81 @brief
82 Chrominance V channel (Cr). Represents the red-difference chroma component in YUV/YCbCr color spaces.
83 """
84
85
86class _PixelFormatMetadata(NamedTuple):
87 string_value: str
88 channels: tuple[Channel, ...]
89 storage_bits_per_channel: int
90 allocated_bits_per_pixel: int
91 numpy_dtype: str
92 is_packed: bool
93 is_interleaved: bool
94 unpacked_format: PixelFormat
95
96
97class PixelFormat(Enum):
98 """!
99 @brief
100 Enum listing all supported pixel formats and their internal IDs.
101
102 Each enumerator represents a specific pixel layout and bit depth,
103 used for interpreting raw image data correctly.
104
105 This class also offers methods to query characteristics of specific
106 pixel formats, such as value ranges, storage sizes, and channel configurations.
107
108 @ingroup ids_peak_common_python_types
109 """
110
111 BAYER_GR_8 = 0x01080008
112 BAYER_GR_10 = 0x0110000C
113 BAYER_GR_12 = 0x01100010
114
115 BAYER_RG_8 = 0x01080009
116 BAYER_RG_10 = 0x0110000D
117 BAYER_RG_12 = 0x01100011
118
119 BAYER_GB_8 = 0x0108000A
120 BAYER_GB_10 = 0x0110000E
121 BAYER_GB_12 = 0x01100012
122
123 BAYER_BG_8 = 0x0108000B
124 BAYER_BG_10 = 0x0110000F
125 BAYER_BG_12 = 0x01100013
126
127 MONO_8 = 0x01080001
128 MONO_10 = 0x01100003
129 MONO_12 = 0x01100005
130 MONO_16 = 0x01100007
131
132 CONFIDENCE_8 = 0x010800C6
133 CONFIDENCE_16 = 0x011000C7
134
135 COORD3D_C8 = 0x010800B1
136 COORD3D_C16 = 0x011000B8
137 COORD3D_C32F = 0x012000BF
138
139 COORD3D_ABC32F = 0x026000C0
140
141 YUV420_8_YY_UV_SEMIPLANAR_IDS = 0x420C0001
142 YUV420_8_YY_VU_SEMIPLANAR_IDS = 0x420C0002
143
144 YUV422_8_UYVY = 0x0210001F
145
146 RGB_8 = 0x02180014
147 RGB_10 = 0x02300018
148 RGB_12 = 0x0230001A
149
150 BGR_8 = 0x02180015
151 BGR_10 = 0x02300019
152 BGR_12 = 0x0230001B
153
154 RGBA_8 = 0x02200016
155 RGBA_10 = 0x0240005F
156 RGBA_12 = 0x02400061
157
158 BGRA_8 = 0x02200017
159 BGRA_10 = 0x0240004C
160 BGRA_12 = 0x0240004E
161
162 BAYER_BG_10_PACKED = 0x010A0052
163 BAYER_BG_12_PACKED = 0x010C0053
164
165 BAYER_GB_10_PACKED = 0x010A0054
166 BAYER_GB_12_PACKED = 0x010C0055
167
168 BAYER_GR_10_PACKED = 0x010A0056
169 BAYER_GR_12_PACKED = 0x010C0057
170
171 BAYER_RG_10_PACKED = 0x010A0058
172 BAYER_RG_12_PACKED = 0x010C0059
173
174 MONO_10_PACKED = 0x010A0046
175 MONO_12_PACKED = 0x010C0047
176
177 RGB_10_PACKED_32 = 0x0220001D
178 BGR_10_PACKED_32 = 0x0220001E
179
180 BAYER_RG_10_GROUPED_40_IDS = 0x40000001
181 BAYER_GB_10_GROUPED_40_IDS = 0x40000002
182 BAYER_GR_10_GROUPED_40_IDS = 0x40000003
183 BAYER_BG_10_GROUPED_40_IDS = 0x40000004
184
185 BAYER_RG_12_GROUPED_24_IDS = 0x40000011
186 BAYER_GB_12_GROUPED_24_IDS = 0x40000012
187 BAYER_GR_12_GROUPED_24_IDS = 0x40000013
188 BAYER_BG_12_GROUPED_24_IDS = 0x40000014
189
190 MONO_10_GROUPED_40_IDS = 0x4000000f
191 MONO_12_GROUPED_24_IDS = 0x4000001f
192
193 MONO_32F_IDS = 0x81200020
194 RGB_32F_IDS = 0x82600021
195
196 MONO_10_GROUPED_40_IDS_INTERLEAVED_A_B = 0x9200000F
197 BAYER_RG_10_GROUPED_40_IDS_INTERLEAVED_A_B = 0x92000001
198 BAYER_BG_10_GROUPED_40_IDS_INTERLEAVED_A_B = 0x92000004
199 BAYER_GR_10_GROUPED_40_IDS_INTERLEAVED_A_B = 0x92000003
200 BAYER_GB_10_GROUPED_40_IDS_INTERLEAVED_A_B = 0x92000002
201 MONO_12_GROUPED_24_IDS_INTERLEAVED_A_B = 0x9200001F
202 BAYER_RG_12_GROUPED_24_IDS_INTERLEAVED_A_B = 0x92000011
203 BAYER_BG_12_GROUPED_24_IDS_INTERLEAVED_A_B = 0x92000014
204 BAYER_GR_12_GROUPED_24_IDS_INTERLEAVED_A_B = 0x92000013
205 BAYER_GB_12_GROUPED_24_IDS_INTERLEAVED_A_B = 0x92000012
206 MONO_8_INTERLEAVED_A_B = 0x92080001
207 BAYER_RG_8_INTERLEAVED_A_B = 0x92080009
208 BAYER_BG_8_INTERLEAVED_A_B = 0x9208000B
209 BAYER_GR_8_INTERLEAVED_A_B = 0x92080008
210 BAYER_GB_8_INTERLEAVED_A_B = 0x9208000A
211 MONO_10_INTERLEAVED_A_B = 0x92100003
212 BAYER_RG_10_INTERLEAVED_A_B = 0x9210000D
213 BAYER_BG_10_INTERLEAVED_A_B = 0x9210000F
214 BAYER_GR_10_INTERLEAVED_A_B = 0x9210000C
215 BAYER_GB_10_INTERLEAVED_A_B = 0x9210000E
216 MONO_12_INTERLEAVED_A_B = 0x92100005
217 BAYER_RG_12_INTERLEAVED_A_B = 0x92100011
218 BAYER_BG_12_INTERLEAVED_A_B = 0x92100013
219 BAYER_GR_12_INTERLEAVED_A_B = 0x92100010
220 BAYER_GB_12_INTERLEAVED_A_B = 0x92100012
221 MONO_10_PACKED_INTERLEAVED_A_B = 0x920A0046
222 BAYER_RG_10_PACKED_INTERLEAVED_A_B = 0x920A0058
223 BAYER_BG_10_PACKED_INTERLEAVED_A_B = 0x920A0052
224 BAYER_GR_10_PACKED_INTERLEAVED_A_B = 0x920A0056
225 BAYER_GB_10_PACKED_INTERLEAVED_A_B = 0x920A0054
226 MONO_12_PACKED_INTERLEAVED_A_B = 0x920C0047
227 BAYER_RG_12_PACKED_INTERLEAVED_A_B = 0x920C0059
228 BAYER_BG_12_PACKED_INTERLEAVED_A_B = 0x920C0053
229 BAYER_GR_12_PACKED_INTERLEAVED_A_B = 0x920C0057
230 BAYER_GB_12_PACKED_INTERLEAVED_A_B = 0x920C0055
231 MONO_8_INTERLEAVED_AB_CD = 0xB2080001
232 MONO_10_INTERLEAVED_AB_CD = 0xB2100003
233 MONO_12_INTERLEAVED_AB_CD = 0xB2100005
234 MONO_10_PACKED_INTERLEAVED_AB_CD = 0xB20A0046
235 MONO_12_PACKED_INTERLEAVED_AB_CD = 0xB20C0047
236 MONO_10_GROUPED_40_IDS_INTERLEAVED_AB_CD = 0xB200000F
237 MONO_12_GROUPED_24_IDS_INTERLEAVED_AB_CD = 0xB200001F
238
239 MONO_10_AB = 0x81200022
240 BAYER_RG_10_AB = 0x81100003
241 BAYER_BG_10_AB = 0x81100004
242 BAYER_GR_10_AB = 0x81100005
243 BAYER_GB_10_AB = 0x81100006
244 MONO_12_AB = 0x81100007
245 BAYER_RG_12_AB = 0x81100008
246 BAYER_BG_12_AB = 0x81100009
247 BAYER_GR_12_AB = 0x8110000a
248 BAYER_GB_12_AB = 0x8110000b
249 MONO_8_AB = 0x8110000c
250 BAYER_RG_8_AB = 0x8110000d
251 BAYER_BG_8_AB = 0x8110000e
252 BAYER_GR_8_AB = 0x8110000f
253 BAYER_GB_8_AB = 0x81100010
254 MONO_8_ABCD = 0x81200011
255 MONO_10_ABCD = 0x81400012
256 MONO_12_ABCD = 0x81400013
257
258 @staticmethod
259 def create_from_string_value(string_value: str) -> PixelFormat:
260 for pixelformat in _pixel_format_metadata:
261 if pixelformat.string_value == string_value:
262 return pixelformat
263
264 raise NotSupportedException(f"The given pixelformat is not supported. Given: {string_value}")
265
266 def __str__(self) -> str:
267 """!
268 @brief
269 Return a human-readable string of the PixelFormat object.
270 """
271 return self.name
272
273 def __repr__(self) -> str:
274 """!
275 @brief
276 Return an unambiguous string of the PixelFormat object.
277 """
278 return f"PixelFormat.{self.name}(value={hex(self._value_)}, string_value={self.string_value!r})"
279
280 @property
281 def minimum_value_per_channel(self) -> Union[int, float]:
282 """!
283 @brief
284 Returns the minimum possible value per channel for the pixel format.
285 """
286 if not self.is_floatis_float:
287 return 0
288 else:
289 return FLOAT32_MIN
290
291 @property
292 def maximum_value_per_channel(self) -> Union[int, float]:
293 """!
294 @brief
295 Returns the maximum possible value per channel for the pixel format.
296 """
297 if not self.is_floatis_float:
298 return int(2 ** self.storage_bits_per_channel - 1)
299 else:
300 return FLOAT32_MAX
301
302 @property
303 def storage_bits_per_channel(self) -> int:
304 """!
305 @brief
306 Returns the number of bits used per channel for storage.
307 """
308 return self._metadata.storage_bits_per_channel
309
310 @property
311 def storage_bits_per_pixel(self) -> int:
312 """!
313 @brief
314 Returns the total number of bits used per pixel for storage.
315 """
316 return self._metadata.storage_bits_per_channel * self.number_of_channels
317
318 @property
319 def string_value(self) -> str:
320 """!
321 @brief
322 Returns the human-readable name of the pixel format.
323 """
324 return self._metadata.string_value
325
326 @property
327 def channels(self) -> Tuple[Channel, ...]:
328 """!
329 @brief
330 Returns the list of channels in the pixel format.
331 """
332 return self._metadata.channels
333
334 @property
335 def allocated_bits_per_pixel(self) -> int:
336 """!
337 @brief
338 Returns the number of allocated bits per pixel.
339 """
340 return self._metadata.allocated_bits_per_pixel
341
342 @property
343 def numpy_dtype(self) -> str:
344 """!
345 @brief
346 Returns the numpy dtype string for this pixel format.
347 """
348 return self._metadata.numpy_dtype
349
350 @property
351 def has_intensity_channel(self) -> bool:
352 """!
353 @brief
354 Returns True if the pixel format has an intensity channel.
355 """
356 return Channel.INTENSITY in self.channelschannels
357
358 @property
359 def number_of_channels(self) -> int:
360 """!
361 @brief
362 Returns the total number of channels in the pixel format.
363 """
364 return len(self.channelschannels)
365
366 @property
367 def is_single_channel(self) -> bool:
368 """!
369 @brief
370 Returns True if the pixel format has only a single channel.
371 """
372 return len(self.channelschannels) == 1
373
374 @property
375 def is_packed(self) -> bool:
376 """!
377 @brief
378 Returns True if the pixel format is packed.
379 """
380 return self._metadata.is_packed
381
382 @property
383 def is_interleaved(self) -> bool:
384 """!
385 @brief
386 Indicates whether the pixel format is interleaved.
387
388 Interleaved pixel formats arrange multiple image streams in memory
389 using different patterns. The exact interleaving strategy depends
390 on the pixel format family:
391
392 **Mono*_A_B**
393 Images A and B alternate by row:
394
395 Memory row 1: Image A (row 1)
396 Memory row 2: Image B (row 1)
397 Memory row 3: Image A (row 2)
398 Memory row 4: Image B (row 2)
399 ...
400
401 **Bayer*_A_B**
402 Images A and B are grouped in pairs of rows:
403
404 Memory row 1: Image A (row 1)
405 Memory row 2: Image A (row 2)
406 Memory row 3: Image B (row 1)
407 Memory row 4: Image B (row 2)
408 Memory row 5: Image A (row 3)
409 Memory row 6: Image A (row 4)
410 Memory row 7: Image B (row 3)
411 Memory row 8: Image B (row 4)
412 ...
413
414 **Mono*_AB_CD**
415 Four image streams (A, B, C, D) are interleaved within each row:
416
417 Memory row 1: | A | B | A | B | A | B |
418 Memory row 2: | C | D | C | D | C | D |
419 Memory row 3: | A | B | A | B | A | B |
420 Memory row 4: | C | D | C | D | C | D |
421 ...
422
423 Returns:
424 bool: True if the pixel format is interleaved, otherwise False.
425 """
426 return self._metadata.is_interleaved
427
428 @property
429 def unpacked_format(self) -> PixelFormat:
430 """!
431 @brief
432 Returns the unpacked pixel format for a packed pixel format.
433 If the pixel format is already unpacked,
434 the same format is returned.
435 """
436 return self._metadata.unpacked_format
437
438 def get_channel_index(self, channel: Channel) -> int:
439 """!
440 @brief
441 Returns the index of a specific channel within the pixel format.
442 """
443 return self.channelschannels.index(channel)
444
445 def has_channel(self, channel: Channel) -> bool:
446 """!
447 @brief
448 Returns True if the pixel format has a specific channel.
449 """
450 return channel in self.channelschannels
451
452 def get_size_in_bytes(self, size: Size) -> int:
453 """!
454 @brief
455 Calculates the memory size in bytes for a given image size.
456 """
457 area = size.width * size.height
458 return int((area * self.allocated_bits_per_pixel + 7) // 8)
459
460 @property
461 def _metadata(self) -> _PixelFormatMetadata:
462 return cast(_PixelFormatMetadata, _pixel_format_metadata.get(self))
463
464 @property
465 def is_float(self) -> bool:
466 return self._metadata.numpy_dtype == "float32"
467
468
469_pixel_format_metadata = {
470 PixelFormat.BAYER_GR_8: _PixelFormatMetadata(
471 string_value="BayerGR8",
472 channels=(Channel.BAYER,),
473 storage_bits_per_channel=8,
474 allocated_bits_per_pixel=8,
475 numpy_dtype="uint8",
476 is_packed=False,
477 is_interleaved=False,
478 unpacked_format=PixelFormat.BAYER_GR_8
479 ),
480
481 PixelFormat.BAYER_GR_10: _PixelFormatMetadata(
482 string_value="BayerGR10",
483 channels=(Channel.BAYER,),
484 storage_bits_per_channel=10,
485 allocated_bits_per_pixel=16,
486 numpy_dtype="uint16",
487 is_packed=False,
488 is_interleaved=False,
489 unpacked_format=PixelFormat.BAYER_GR_10
490 ),
491
492 PixelFormat.BAYER_GR_12: _PixelFormatMetadata(
493 string_value="BayerGR12",
494 channels=(Channel.BAYER,),
495 storage_bits_per_channel=12,
496 allocated_bits_per_pixel=16,
497 numpy_dtype="uint16",
498 is_packed=False,
499 is_interleaved=False,
500 unpacked_format=PixelFormat.BAYER_GR_12
501 ),
502
503 PixelFormat.BAYER_RG_8: _PixelFormatMetadata(
504 string_value="BayerRG8",
505 channels=(Channel.BAYER,),
506 storage_bits_per_channel=8,
507 allocated_bits_per_pixel=8,
508 numpy_dtype="uint8",
509 is_packed=False,
510 is_interleaved=False,
511 unpacked_format=PixelFormat.BAYER_RG_8
512 ),
513
514 PixelFormat.BAYER_RG_10: _PixelFormatMetadata(
515 string_value="BayerRG10",
516 channels=(Channel.BAYER,),
517 storage_bits_per_channel=10,
518 allocated_bits_per_pixel=16,
519 numpy_dtype="uint16",
520 is_packed=False,
521 is_interleaved=False,
522 unpacked_format=PixelFormat.BAYER_RG_10
523 ),
524
525 PixelFormat.BAYER_RG_12: _PixelFormatMetadata(
526 string_value="BayerRG12",
527 channels=(Channel.BAYER,),
528 storage_bits_per_channel=12,
529 allocated_bits_per_pixel=16,
530 numpy_dtype="uint16",
531 is_packed=False,
532 is_interleaved=False,
533 unpacked_format=PixelFormat.BAYER_RG_12
534 ),
535
536 PixelFormat.BAYER_GB_8: _PixelFormatMetadata(
537 string_value="BayerGB8",
538 channels=(Channel.BAYER,),
539 storage_bits_per_channel=8,
540 allocated_bits_per_pixel=8,
541 numpy_dtype="uint8",
542 is_packed=False,
543 is_interleaved=False,
544 unpacked_format=PixelFormat.BAYER_GB_8
545 ),
546
547 PixelFormat.BAYER_GB_10: _PixelFormatMetadata(
548 string_value="BayerGB10",
549 channels=(Channel.BAYER,),
550 storage_bits_per_channel=10,
551 allocated_bits_per_pixel=16,
552 numpy_dtype="uint16",
553 is_packed=False,
554 is_interleaved=False,
555 unpacked_format=PixelFormat.BAYER_GB_10
556 ),
557
558 PixelFormat.BAYER_GB_12: _PixelFormatMetadata(
559 string_value="BayerGB12",
560 channels=(Channel.BAYER,),
561 storage_bits_per_channel=12,
562 allocated_bits_per_pixel=16,
563 numpy_dtype="uint16",
564 is_packed=False,
565 is_interleaved=False,
566 unpacked_format=PixelFormat.BAYER_GB_12
567 ),
568
569 PixelFormat.BAYER_BG_8: _PixelFormatMetadata(
570 string_value="BayerBG8",
571 channels=(Channel.BAYER,),
572 storage_bits_per_channel=8,
573 allocated_bits_per_pixel=8,
574 numpy_dtype="uint8",
575 is_packed=False,
576 is_interleaved=False,
577 unpacked_format=PixelFormat.BAYER_BG_8
578 ),
579
580 PixelFormat.BAYER_BG_10: _PixelFormatMetadata(
581 string_value="BayerBG10",
582 channels=(Channel.BAYER,),
583 storage_bits_per_channel=10,
584 allocated_bits_per_pixel=16,
585 numpy_dtype="uint16",
586 is_packed=False,
587 is_interleaved=False,
588 unpacked_format=PixelFormat.BAYER_BG_10
589 ),
590
591 PixelFormat.BAYER_BG_12: _PixelFormatMetadata(
592 string_value="BayerBG12",
593 channels=(Channel.BAYER,),
594 storage_bits_per_channel=12,
595 allocated_bits_per_pixel=16,
596 numpy_dtype="uint16",
597 is_packed=False,
598 is_interleaved=False,
599 unpacked_format=PixelFormat.BAYER_BG_12
600 ),
601
602 PixelFormat.MONO_8: _PixelFormatMetadata(
603 string_value="Mono8",
604 channels=(Channel.INTENSITY,),
605 storage_bits_per_channel=8,
606 allocated_bits_per_pixel=8,
607 numpy_dtype="uint8",
608 is_packed=False,
609 is_interleaved=False,
610 unpacked_format=PixelFormat.MONO_8
611 ),
612
613 PixelFormat.MONO_10: _PixelFormatMetadata(
614 string_value="Mono10",
615 channels=(Channel.INTENSITY,),
616 storage_bits_per_channel=10,
617 allocated_bits_per_pixel=16,
618 numpy_dtype="uint16",
619 is_packed=False,
620 is_interleaved=False,
621 unpacked_format=PixelFormat.MONO_10
622 ),
623
624 PixelFormat.MONO_12: _PixelFormatMetadata(
625 string_value="Mono12",
626 channels=(Channel.INTENSITY,),
627 storage_bits_per_channel=12,
628 allocated_bits_per_pixel=16,
629 numpy_dtype="uint16",
630 is_packed=False,
631 is_interleaved=False,
632 unpacked_format=PixelFormat.MONO_12
633 ),
634
635 PixelFormat.MONO_16: _PixelFormatMetadata(
636 string_value="Mono16",
637 channels=(Channel.INTENSITY,),
638 storage_bits_per_channel=16,
639 allocated_bits_per_pixel=16,
640 numpy_dtype="uint16",
641 is_packed=False,
642 is_interleaved=False,
643 unpacked_format=PixelFormat.MONO_16
644 ),
645
646 PixelFormat.CONFIDENCE_8: _PixelFormatMetadata(
647 string_value="Confidence8",
648 channels=(Channel.INTENSITY,),
649 storage_bits_per_channel=8,
650 allocated_bits_per_pixel=8,
651 numpy_dtype="uint8",
652 is_packed=False,
653 is_interleaved=False,
654 unpacked_format=PixelFormat.CONFIDENCE_8
655 ),
656
657 PixelFormat.CONFIDENCE_16: _PixelFormatMetadata(
658 string_value="Confidence16",
659 channels=(Channel.INTENSITY,),
660 storage_bits_per_channel=16,
661 allocated_bits_per_pixel=16,
662 numpy_dtype="uint16",
663 is_packed=False,
664 is_interleaved=False,
665 unpacked_format=PixelFormat.CONFIDENCE_16
666 ),
667
668 PixelFormat.COORD3D_C8: _PixelFormatMetadata(
669 string_value="Coord3D_C8",
670 channels=(Channel.INTENSITY,),
671 storage_bits_per_channel=8,
672 allocated_bits_per_pixel=8,
673 numpy_dtype="uint8",
674 is_packed=False,
675 is_interleaved=False,
676 unpacked_format=PixelFormat.COORD3D_C8
677 ),
678
679 PixelFormat.COORD3D_C16: _PixelFormatMetadata(
680 string_value="Coord3D_C16",
681 channels=(Channel.INTENSITY,),
682 storage_bits_per_channel=16,
683 allocated_bits_per_pixel=16,
684 numpy_dtype="uint16",
685 is_packed=False,
686 is_interleaved=False,
687 unpacked_format=PixelFormat.COORD3D_C16
688 ),
689
690 PixelFormat.COORD3D_C32F: _PixelFormatMetadata(
691 string_value="Coord3D_C32f",
692 channels=(Channel.INTENSITY,),
693 storage_bits_per_channel=32,
694 allocated_bits_per_pixel=32,
695 numpy_dtype="float32",
696 is_packed=False,
697 is_interleaved=False,
698 unpacked_format=PixelFormat.COORD3D_C32F
699 ),
700
701 PixelFormat.COORD3D_ABC32F: _PixelFormatMetadata(
702 string_value="Coord3D_ABC32f",
703 channels=(Channel.X, Channel.Y, Channel.Z),
704 storage_bits_per_channel=32,
705 allocated_bits_per_pixel=96,
706 numpy_dtype="float32",
707 is_packed=False,
708 is_interleaved=False,
709 unpacked_format=PixelFormat.COORD3D_ABC32F
710 ),
711
712 PixelFormat.YUV420_8_YY_UV_SEMIPLANAR_IDS: _PixelFormatMetadata(
713 string_value="YUV420_8_YY_UV_SemiplanarIDS",
714 channels=(Channel.INTENSITY, Channel.CHROMA_U, Channel.CHROMA_V),
715 storage_bits_per_channel=8,
716 allocated_bits_per_pixel=12,
717 numpy_dtype="uint8",
718 is_packed=False,
719 is_interleaved=False,
720 unpacked_format=PixelFormat.YUV420_8_YY_UV_SEMIPLANAR_IDS
721 ),
722
723 PixelFormat.YUV420_8_YY_VU_SEMIPLANAR_IDS: _PixelFormatMetadata(
724 string_value="YUV420_8_YY_VU_SemiplanarIDS",
725 channels=(Channel.INTENSITY, Channel.CHROMA_V, Channel.CHROMA_U),
726 storage_bits_per_channel=8,
727 allocated_bits_per_pixel=12,
728 numpy_dtype="uint8",
729 is_packed=False,
730 is_interleaved=False,
731 unpacked_format=PixelFormat.YUV420_8_YY_VU_SEMIPLANAR_IDS
732 ),
733
734 PixelFormat.YUV422_8_UYVY: _PixelFormatMetadata(
735 string_value="YUV422_8_UYVY",
736 channels=(Channel.INTENSITY, Channel.CHROMA_U, Channel.CHROMA_V),
737 storage_bits_per_channel=8,
738 allocated_bits_per_pixel=16,
739 numpy_dtype="uint8",
740 is_packed=False,
741 is_interleaved=False,
742 unpacked_format=PixelFormat.YUV422_8_UYVY
743 ),
744
745 PixelFormat.RGB_8: _PixelFormatMetadata(
746 string_value="RGB8",
747 channels=(Channel.RED, Channel.GREEN, Channel.BLUE),
748 storage_bits_per_channel=8,
749 allocated_bits_per_pixel=24,
750 numpy_dtype="uint8",
751 is_packed=False,
752 is_interleaved=False,
753 unpacked_format=PixelFormat.RGB_8
754 ),
755
756 PixelFormat.RGB_10: _PixelFormatMetadata(
757 string_value="RGB10",
758 channels=(Channel.RED, Channel.GREEN, Channel.BLUE),
759 storage_bits_per_channel=10,
760 allocated_bits_per_pixel=48,
761 numpy_dtype="uint16",
762 is_packed=False,
763 is_interleaved=False,
764 unpacked_format=PixelFormat.RGB_10
765 ),
766
767 PixelFormat.RGB_12: _PixelFormatMetadata(
768 string_value="RGB12",
769 channels=(Channel.RED, Channel.GREEN, Channel.BLUE),
770 storage_bits_per_channel=12,
771 allocated_bits_per_pixel=48,
772 numpy_dtype="uint16",
773 is_packed=False,
774 is_interleaved=False,
775 unpacked_format=PixelFormat.RGB_12
776 ),
777
778 PixelFormat.BGR_8: _PixelFormatMetadata(
779 string_value="BGR8",
780 channels=(Channel.BLUE, Channel.GREEN, Channel.RED),
781 storage_bits_per_channel=8,
782 allocated_bits_per_pixel=24,
783 numpy_dtype="uint8",
784 is_packed=False,
785 is_interleaved=False,
786 unpacked_format=PixelFormat.BGR_8
787 ),
788
789 PixelFormat.BGR_10: _PixelFormatMetadata(
790 string_value="BGR10",
791 channels=(Channel.BLUE, Channel.GREEN, Channel.RED),
792 storage_bits_per_channel=10,
793 allocated_bits_per_pixel=48,
794 numpy_dtype="uint16",
795 is_packed=False,
796 is_interleaved=False,
797 unpacked_format=PixelFormat.BGR_10
798 ),
799
800 PixelFormat.BGR_12: _PixelFormatMetadata(
801 string_value="BGR12",
802 channels=(Channel.BLUE, Channel.GREEN, Channel.RED),
803 storage_bits_per_channel=12,
804 allocated_bits_per_pixel=48,
805 numpy_dtype="uint16",
806 is_packed=False,
807 is_interleaved=False,
808 unpacked_format=PixelFormat.BGR_12
809 ),
810
811 PixelFormat.RGBA_8: _PixelFormatMetadata(
812 string_value="RGBa8",
813 channels=(Channel.RED, Channel.GREEN, Channel.BLUE, Channel.ALPHA),
814 storage_bits_per_channel=8,
815 allocated_bits_per_pixel=32,
816 numpy_dtype="uint8",
817 is_packed=False,
818 is_interleaved=False,
819 unpacked_format=PixelFormat.RGBA_8
820 ),
821
822 PixelFormat.RGBA_10: _PixelFormatMetadata(
823 string_value="RGBa10",
824 channels=(Channel.RED, Channel.GREEN, Channel.BLUE, Channel.ALPHA),
825 storage_bits_per_channel=10,
826 allocated_bits_per_pixel=64,
827 numpy_dtype="uint16",
828 is_packed=False,
829 is_interleaved=False,
830 unpacked_format=PixelFormat.RGBA_10
831 ),
832
833 PixelFormat.RGBA_12: _PixelFormatMetadata(
834 string_value="RGBa12",
835 channels=(Channel.RED, Channel.GREEN, Channel.BLUE, Channel.ALPHA),
836 storage_bits_per_channel=12,
837 allocated_bits_per_pixel=64,
838 numpy_dtype="uint16",
839 is_packed=False,
840 is_interleaved=False,
841 unpacked_format=PixelFormat.RGBA_12
842 ),
843
844 PixelFormat.BGRA_8: _PixelFormatMetadata(
845 string_value="BGRa8",
846 channels=(Channel.BLUE, Channel.GREEN, Channel.RED, Channel.ALPHA),
847 storage_bits_per_channel=8,
848 allocated_bits_per_pixel=32,
849 numpy_dtype="uint8",
850 is_packed=False,
851 is_interleaved=False,
852 unpacked_format=PixelFormat.BGRA_8
853 ),
854
855 PixelFormat.BGRA_10: _PixelFormatMetadata(
856 string_value="BGRa10",
857 channels=(Channel.BLUE, Channel.GREEN, Channel.RED, Channel.ALPHA),
858 storage_bits_per_channel=10,
859 allocated_bits_per_pixel=64,
860 numpy_dtype="uint16",
861 is_packed=False,
862 is_interleaved=False,
863 unpacked_format=PixelFormat.BGRA_10
864 ),
865
866 PixelFormat.BGRA_12: _PixelFormatMetadata(
867 string_value="BGRa12",
868 channels=(Channel.BLUE, Channel.GREEN, Channel.RED, Channel.ALPHA),
869 storage_bits_per_channel=12,
870 allocated_bits_per_pixel=64,
871 numpy_dtype="uint16",
872 is_packed=False,
873 is_interleaved=False,
874 unpacked_format=PixelFormat.BGRA_12
875 ),
876
877 PixelFormat.BAYER_BG_10_PACKED: _PixelFormatMetadata(
878 string_value="BayerBG10p",
879 channels=(Channel.BAYER,),
880 storage_bits_per_channel=10,
881 allocated_bits_per_pixel=10,
882 numpy_dtype="uint8",
883 is_packed=True,
884 is_interleaved=False,
885 unpacked_format=PixelFormat.BAYER_BG_10
886 ),
887
888 PixelFormat.BAYER_BG_12_PACKED: _PixelFormatMetadata(
889 string_value="BayerBG12p",
890 channels=(Channel.BAYER,),
891 storage_bits_per_channel=12,
892 allocated_bits_per_pixel=12,
893 numpy_dtype="uint8",
894 is_packed=True,
895 is_interleaved=False,
896 unpacked_format=PixelFormat.BAYER_BG_12
897 ),
898
899 PixelFormat.BAYER_GB_10_PACKED: _PixelFormatMetadata(
900 string_value="BayerGB10p",
901 channels=(Channel.BAYER,),
902 storage_bits_per_channel=10,
903 allocated_bits_per_pixel=10,
904 numpy_dtype="uint8",
905 is_packed=True,
906 is_interleaved=False,
907 unpacked_format=PixelFormat.BAYER_GB_10
908 ),
909
910 PixelFormat.BAYER_GB_12_PACKED: _PixelFormatMetadata(
911 string_value="BayerGB12p",
912 channels=(Channel.BAYER,),
913 storage_bits_per_channel=12,
914 allocated_bits_per_pixel=12,
915 numpy_dtype="uint8",
916 is_packed=True,
917 is_interleaved=False,
918 unpacked_format=PixelFormat.BAYER_GB_12
919 ),
920
921 PixelFormat.BAYER_GR_10_PACKED: _PixelFormatMetadata(
922 string_value="BayerGR10p",
923 channels=(Channel.BAYER,),
924 storage_bits_per_channel=10,
925 allocated_bits_per_pixel=10,
926 numpy_dtype="uint8",
927 is_packed=True,
928 is_interleaved=False,
929 unpacked_format=PixelFormat.BAYER_GR_10
930 ),
931
932 PixelFormat.BAYER_GR_12_PACKED: _PixelFormatMetadata(
933 string_value="BayerGR12p",
934 channels=(Channel.BAYER,),
935 storage_bits_per_channel=12,
936 allocated_bits_per_pixel=12,
937 numpy_dtype="uint8",
938 is_packed=True,
939 is_interleaved=False,
940 unpacked_format=PixelFormat.BAYER_GR_12
941 ),
942
943 PixelFormat.BAYER_RG_10_PACKED: _PixelFormatMetadata(
944 string_value="BayerRG10p",
945 channels=(Channel.BAYER,),
946 storage_bits_per_channel=10,
947 allocated_bits_per_pixel=10,
948 numpy_dtype="uint8",
949 is_packed=True,
950 is_interleaved=False,
951 unpacked_format=PixelFormat.BAYER_RG_10
952 ),
953
954 PixelFormat.BAYER_RG_12_PACKED: _PixelFormatMetadata(
955 string_value="BayerRG12p",
956 channels=(Channel.BAYER,),
957 storage_bits_per_channel=12,
958 allocated_bits_per_pixel=12,
959 numpy_dtype="uint8",
960 is_packed=True,
961 is_interleaved=False,
962 unpacked_format=PixelFormat.BAYER_RG_12
963 ),
964
965 PixelFormat.MONO_10_PACKED: _PixelFormatMetadata(
966 string_value="Mono10p",
967 channels=(Channel.INTENSITY,),
968 storage_bits_per_channel=10,
969 allocated_bits_per_pixel=10,
970 numpy_dtype="uint8",
971 is_packed=True,
972 is_interleaved=False,
973 unpacked_format=PixelFormat.MONO_10
974 ),
975
976 PixelFormat.MONO_12_PACKED: _PixelFormatMetadata(
977 string_value="Mono12p",
978 channels=(Channel.INTENSITY,),
979 storage_bits_per_channel=12,
980 allocated_bits_per_pixel=12,
981 numpy_dtype="uint8",
982 is_packed=True,
983 is_interleaved=False,
984 unpacked_format=PixelFormat.MONO_12
985 ),
986
987 PixelFormat.RGB_10_PACKED_32: _PixelFormatMetadata(
988 string_value="RGB10p32",
989 channels=(Channel.RED, Channel.GREEN, Channel.BLUE),
990 # [w x h x channel] 2 x 2 x 3 (32bit) falsch! 2x2x1 richtig!
991 storage_bits_per_channel=10,
992 allocated_bits_per_pixel=32,
993 numpy_dtype="uint32",
994 is_packed=True,
995 is_interleaved=False,
996 unpacked_format=PixelFormat.RGB_10
997 ),
998
999 PixelFormat.BGR_10_PACKED_32: _PixelFormatMetadata(
1000 string_value="BGR10p32",
1001 channels=(Channel.BLUE, Channel.GREEN, Channel.RED),
1002 storage_bits_per_channel=10,
1003 allocated_bits_per_pixel=32,
1004 numpy_dtype="uint32",
1005 is_packed=True,
1006 is_interleaved=False,
1007 unpacked_format=PixelFormat.BGR_10
1008 ),
1009
1010 PixelFormat.BAYER_RG_10_GROUPED_40_IDS: _PixelFormatMetadata(
1011 string_value="BayerRG10g40IDS",
1012 channels=(Channel.BAYER,),
1013 storage_bits_per_channel=10,
1014 allocated_bits_per_pixel=10,
1015 numpy_dtype="uint8",
1016 is_packed=True,
1017 is_interleaved=False,
1018 unpacked_format=PixelFormat.BAYER_RG_10
1019 ),
1020
1021 PixelFormat.BAYER_GB_10_GROUPED_40_IDS: _PixelFormatMetadata(
1022 string_value="BayerGB10g40IDS",
1023 channels=(Channel.BAYER,),
1024 storage_bits_per_channel=10,
1025 allocated_bits_per_pixel=10,
1026 numpy_dtype="uint8",
1027 is_packed=True,
1028 is_interleaved=False,
1029 unpacked_format=PixelFormat.BAYER_GB_10
1030 ),
1031
1032 PixelFormat.BAYER_GR_10_GROUPED_40_IDS: _PixelFormatMetadata(
1033 string_value="BayerGR10g40IDS",
1034 channels=(Channel.BAYER,),
1035 storage_bits_per_channel=10,
1036 allocated_bits_per_pixel=10,
1037 numpy_dtype="uint8",
1038 is_packed=True,
1039 is_interleaved=False,
1040 unpacked_format=PixelFormat.BAYER_GR_10
1041 ),
1042
1043 PixelFormat.BAYER_BG_10_GROUPED_40_IDS: _PixelFormatMetadata(
1044 string_value="BayerBG10g40IDS",
1045 channels=(Channel.BAYER,),
1046 storage_bits_per_channel=10,
1047 allocated_bits_per_pixel=10,
1048 numpy_dtype="uint8",
1049 is_packed=True,
1050 is_interleaved=False,
1051 unpacked_format=PixelFormat.BAYER_BG_10
1052 ),
1053
1054 PixelFormat.BAYER_RG_12_GROUPED_24_IDS: _PixelFormatMetadata(
1055 string_value="BayerRG12g24IDS",
1056 channels=(Channel.BAYER,),
1057 storage_bits_per_channel=12,
1058 allocated_bits_per_pixel=12,
1059 numpy_dtype="uint8",
1060 is_packed=True,
1061 is_interleaved=False,
1062 unpacked_format=PixelFormat.BAYER_RG_12
1063 ),
1064
1065 PixelFormat.BAYER_GB_12_GROUPED_24_IDS: _PixelFormatMetadata(
1066 string_value="BayerGB12g24IDS",
1067 channels=(Channel.BAYER,),
1068 storage_bits_per_channel=12,
1069 allocated_bits_per_pixel=12,
1070 numpy_dtype="uint8",
1071 is_packed=True,
1072 is_interleaved=False,
1073 unpacked_format=PixelFormat.BAYER_GB_12
1074 ),
1075
1076 PixelFormat.BAYER_GR_12_GROUPED_24_IDS: _PixelFormatMetadata(
1077 string_value="BayerGR12g24IDS",
1078 channels=(Channel.BAYER,),
1079 storage_bits_per_channel=12,
1080 allocated_bits_per_pixel=12,
1081 numpy_dtype="uint8",
1082 is_packed=True,
1083 is_interleaved=False,
1084 unpacked_format=PixelFormat.BAYER_GR_12
1085 ),
1086
1087 PixelFormat.BAYER_BG_12_GROUPED_24_IDS: _PixelFormatMetadata(
1088 string_value="BayerBG12g24IDS",
1089 channels=(Channel.BAYER,),
1090 storage_bits_per_channel=12,
1091 allocated_bits_per_pixel=12,
1092 numpy_dtype="uint8",
1093 is_packed=True,
1094 is_interleaved=False,
1095 unpacked_format=PixelFormat.BAYER_BG_12
1096 ),
1097
1098 PixelFormat.MONO_10_GROUPED_40_IDS: _PixelFormatMetadata(
1099 string_value="Mono10g40IDS",
1100 channels=(Channel.INTENSITY,),
1101 storage_bits_per_channel=10,
1102 allocated_bits_per_pixel=10,
1103 numpy_dtype="uint8",
1104 is_packed=True,
1105 is_interleaved=False,
1106 unpacked_format=PixelFormat.MONO_10
1107 ),
1108
1109 PixelFormat.MONO_12_GROUPED_24_IDS: _PixelFormatMetadata(
1110 string_value="Mono12g24IDS",
1111 channels=(Channel.INTENSITY,),
1112 storage_bits_per_channel=12,
1113 allocated_bits_per_pixel=12,
1114 numpy_dtype="uint8",
1115 is_packed=True,
1116 is_interleaved=False,
1117 unpacked_format=PixelFormat.MONO_12
1118 ),
1119
1120 PixelFormat.MONO_32F_IDS: _PixelFormatMetadata(
1121 string_value="Mono32fIDS",
1122 channels=(Channel.INTENSITY,),
1123 storage_bits_per_channel=32,
1124 allocated_bits_per_pixel=32,
1125 numpy_dtype="float32",
1126 is_packed=False,
1127 is_interleaved=False,
1128 unpacked_format=PixelFormat.MONO_32F_IDS
1129 ),
1130
1131 PixelFormat.RGB_32F_IDS: _PixelFormatMetadata(
1132 string_value="RGB32fIDS",
1133 channels=(Channel.RED, Channel.GREEN, Channel.BLUE),
1134 storage_bits_per_channel=32,
1135 allocated_bits_per_pixel=96,
1136 numpy_dtype="float32",
1137 is_packed=False,
1138 is_interleaved=False,
1139 unpacked_format=PixelFormat.RGB_32F_IDS
1140 ),
1141
1142 PixelFormat.MONO_10_GROUPED_40_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1143 string_value="Mono10g40IDS_I_A_B",
1144 channels=(Channel.INTENSITY,),
1145 storage_bits_per_channel=10,
1146 allocated_bits_per_pixel=10,
1147 numpy_dtype="uint8",
1148 is_packed=True,
1149 is_interleaved=True,
1150 unpacked_format=PixelFormat.MONO_10_AB
1151 ),
1152
1153 PixelFormat.BAYER_RG_10_GROUPED_40_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1154 string_value="BayerRG10g40IDS_I_A_B",
1155 channels=(Channel.BAYER,),
1156 storage_bits_per_channel=10,
1157 allocated_bits_per_pixel=10,
1158 numpy_dtype="uint8",
1159 is_packed=True,
1160 is_interleaved=True,
1161 unpacked_format=PixelFormat.BAYER_RG_10_AB
1162 ),
1163
1164 PixelFormat.BAYER_BG_10_GROUPED_40_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1165 string_value="BayerBG10g40IDS_I_A_B",
1166 channels=(Channel.BAYER,),
1167 storage_bits_per_channel=10,
1168 allocated_bits_per_pixel=10,
1169 numpy_dtype="uint8",
1170 is_packed=True,
1171 is_interleaved=True,
1172 unpacked_format=PixelFormat.BAYER_BG_10_AB
1173 ),
1174
1175 PixelFormat.BAYER_GR_10_GROUPED_40_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1176 string_value="BayerGR10g40IDS_I_A_B",
1177 channels=(Channel.BAYER,),
1178 storage_bits_per_channel=10,
1179 allocated_bits_per_pixel=10,
1180 numpy_dtype="uint8",
1181 is_packed=True,
1182 is_interleaved=True,
1183 unpacked_format=PixelFormat.BAYER_GR_10_AB
1184 ),
1185
1186 PixelFormat.BAYER_GB_10_GROUPED_40_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1187 string_value="BayerGB10g40IDS_I_A_B",
1188 channels=(Channel.BAYER,),
1189 storage_bits_per_channel=10,
1190 allocated_bits_per_pixel=10,
1191 numpy_dtype="uint8",
1192 is_packed=True,
1193 is_interleaved=True,
1194 unpacked_format=PixelFormat.BAYER_GB_10_AB
1195 ),
1196
1197 PixelFormat.MONO_12_GROUPED_24_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1198 string_value="Mono12g24IDS_I_A_B",
1199 channels=(Channel.INTENSITY,),
1200 storage_bits_per_channel=12,
1201 allocated_bits_per_pixel=12,
1202 numpy_dtype="uint8",
1203 is_packed=True,
1204 is_interleaved=True,
1205 unpacked_format=PixelFormat.MONO_12_AB
1206 ),
1207
1208 PixelFormat.BAYER_RG_12_GROUPED_24_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1209 string_value="BayerRG12g24IDS_I_A_B",
1210 channels=(Channel.BAYER,),
1211 storage_bits_per_channel=12,
1212 allocated_bits_per_pixel=12,
1213 numpy_dtype="uint8",
1214 is_packed=True,
1215 is_interleaved=True,
1216 unpacked_format=PixelFormat.BAYER_RG_12_AB
1217 ),
1218
1219 PixelFormat.BAYER_BG_12_GROUPED_24_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1220 string_value="BayerBG12g24IDS_I_A_B",
1221 channels=(Channel.BAYER,),
1222 storage_bits_per_channel=12,
1223 allocated_bits_per_pixel=12,
1224 numpy_dtype="uint8",
1225 is_packed=True,
1226 is_interleaved=True,
1227 unpacked_format=PixelFormat.BAYER_BG_12_AB
1228 ),
1229
1230 PixelFormat.BAYER_GR_12_GROUPED_24_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1231 string_value="BayerGR12g24IDS_I_A_B",
1232 channels=(Channel.BAYER,),
1233 storage_bits_per_channel=12,
1234 allocated_bits_per_pixel=12,
1235 numpy_dtype="uint8",
1236 is_packed=True,
1237 is_interleaved=True,
1238 unpacked_format=PixelFormat.BAYER_GR_12_AB
1239 ),
1240
1241 PixelFormat.BAYER_GB_12_GROUPED_24_IDS_INTERLEAVED_A_B: _PixelFormatMetadata(
1242 string_value="BayerGB12g24IDS_I_A_B",
1243 channels=(Channel.BAYER,),
1244 storage_bits_per_channel=12,
1245 allocated_bits_per_pixel=12,
1246 numpy_dtype="uint8",
1247 is_packed=True,
1248 is_interleaved=True,
1249 unpacked_format=PixelFormat.BAYER_GB_12_AB
1250 ),
1251
1252 PixelFormat.MONO_8_INTERLEAVED_A_B: _PixelFormatMetadata(
1253 string_value="Mono8_I_A_B",
1254 channels=(Channel.INTENSITY,),
1255 storage_bits_per_channel=8,
1256 allocated_bits_per_pixel=8,
1257 numpy_dtype="uint8",
1258 is_packed=False,
1259 is_interleaved=True,
1260 unpacked_format=PixelFormat.MONO_8_AB
1261 ),
1262
1263 PixelFormat.BAYER_RG_8_INTERLEAVED_A_B: _PixelFormatMetadata(
1264 string_value="BayerRG8_I_A_B",
1265 channels=(Channel.BAYER,),
1266 storage_bits_per_channel=8,
1267 allocated_bits_per_pixel=8,
1268 numpy_dtype="uint8",
1269 is_packed=False,
1270 is_interleaved=True,
1271 unpacked_format=PixelFormat.BAYER_RG_8_AB
1272 ),
1273
1274 PixelFormat.BAYER_BG_8_INTERLEAVED_A_B: _PixelFormatMetadata(
1275 string_value="BayerBG8_I_A_B",
1276 channels=(Channel.BAYER,),
1277 storage_bits_per_channel=8,
1278 allocated_bits_per_pixel=8,
1279 numpy_dtype="uint8",
1280 is_packed=False,
1281 is_interleaved=True,
1282 unpacked_format=PixelFormat.BAYER_BG_8_AB
1283 ),
1284
1285 PixelFormat.BAYER_GR_8_INTERLEAVED_A_B: _PixelFormatMetadata(
1286 string_value="BayerGR8_I_A_B",
1287 channels=(Channel.BAYER,),
1288 storage_bits_per_channel=8,
1289 allocated_bits_per_pixel=8,
1290 numpy_dtype="uint8",
1291 is_packed=False,
1292 is_interleaved=True,
1293 unpacked_format=PixelFormat.BAYER_GR_8_AB
1294 ),
1295
1296 PixelFormat.BAYER_GB_8_INTERLEAVED_A_B: _PixelFormatMetadata(
1297 string_value="BayerGB8_I_A_B",
1298 channels=(Channel.BAYER,),
1299 storage_bits_per_channel=8,
1300 allocated_bits_per_pixel=8,
1301 numpy_dtype="uint8",
1302 is_packed=False,
1303 is_interleaved=True,
1304 unpacked_format=PixelFormat.BAYER_GB_8_AB
1305 ),
1306
1307 PixelFormat.MONO_10_INTERLEAVED_A_B: _PixelFormatMetadata(
1308 string_value="Mono10_I_A_B",
1309 channels=(Channel.INTENSITY,),
1310 storage_bits_per_channel=10,
1311 allocated_bits_per_pixel=16,
1312 numpy_dtype="uint16",
1313 is_packed=False,
1314 is_interleaved=True,
1315 unpacked_format=PixelFormat.MONO_10_AB
1316 ),
1317
1318 PixelFormat.BAYER_RG_10_INTERLEAVED_A_B: _PixelFormatMetadata(
1319 string_value="BayerRG10_I_A_B",
1320 channels=(Channel.BAYER,),
1321 storage_bits_per_channel=10,
1322 allocated_bits_per_pixel=16,
1323 numpy_dtype="uint16",
1324 is_packed=False,
1325 is_interleaved=True,
1326 unpacked_format=PixelFormat.BAYER_RG_10_AB
1327 ),
1328
1329 PixelFormat.BAYER_BG_10_INTERLEAVED_A_B: _PixelFormatMetadata(
1330 string_value="BayerBG10_I_A_B",
1331 channels=(Channel.BAYER,),
1332 storage_bits_per_channel=10,
1333 allocated_bits_per_pixel=16,
1334 numpy_dtype="uint16",
1335 is_packed=False,
1336 is_interleaved=True,
1337 unpacked_format=PixelFormat.BAYER_BG_10_AB
1338 ),
1339
1340 PixelFormat.BAYER_GR_10_INTERLEAVED_A_B: _PixelFormatMetadata(
1341 string_value="BayerGR10_I_A_B",
1342 channels=(Channel.BAYER,),
1343 storage_bits_per_channel=10,
1344 allocated_bits_per_pixel=16,
1345 numpy_dtype="uint16",
1346 is_packed=False,
1347 is_interleaved=True,
1348 unpacked_format=PixelFormat.BAYER_GR_10_AB
1349 ),
1350
1351 PixelFormat.BAYER_GB_10_INTERLEAVED_A_B: _PixelFormatMetadata(
1352 string_value="BayerGB10_I_A_B",
1353 channels=(Channel.BAYER,),
1354 storage_bits_per_channel=10,
1355 allocated_bits_per_pixel=16,
1356 numpy_dtype="uint16",
1357 is_packed=False,
1358 is_interleaved=True,
1359 unpacked_format=PixelFormat.BAYER_GB_10_AB
1360 ),
1361
1362 PixelFormat.MONO_12_INTERLEAVED_A_B: _PixelFormatMetadata(
1363 string_value="Mono12_I_A_B",
1364 channels=(Channel.INTENSITY,),
1365 storage_bits_per_channel=12,
1366 allocated_bits_per_pixel=16,
1367 numpy_dtype="uint16",
1368 is_packed=False,
1369 is_interleaved=True,
1370 unpacked_format=PixelFormat.MONO_12_AB
1371 ),
1372
1373 PixelFormat.BAYER_RG_12_INTERLEAVED_A_B: _PixelFormatMetadata(
1374 string_value="BayerRG12_I_A_B",
1375 channels=(Channel.BAYER,),
1376 storage_bits_per_channel=12,
1377 allocated_bits_per_pixel=16,
1378 numpy_dtype="uint16",
1379 is_packed=False,
1380 is_interleaved=True,
1381 unpacked_format=PixelFormat.BAYER_RG_12_AB
1382 ),
1383
1384 PixelFormat.BAYER_BG_12_INTERLEAVED_A_B: _PixelFormatMetadata(
1385 string_value="BayerBG12_I_A_B",
1386 channels=(Channel.BAYER,),
1387 storage_bits_per_channel=12,
1388 allocated_bits_per_pixel=16,
1389 numpy_dtype="uint16",
1390 is_packed=False,
1391 is_interleaved=True,
1392 unpacked_format=PixelFormat.BAYER_BG_12_AB
1393 ),
1394
1395 PixelFormat.BAYER_GR_12_INTERLEAVED_A_B: _PixelFormatMetadata(
1396 string_value="BayerGR12_I_A_B",
1397 channels=(Channel.BAYER,),
1398 storage_bits_per_channel=12,
1399 allocated_bits_per_pixel=16,
1400 numpy_dtype="uint16",
1401 is_packed=False,
1402 is_interleaved=True,
1403 unpacked_format=PixelFormat.BAYER_GR_12_AB
1404 ),
1405
1406 PixelFormat.BAYER_GB_12_INTERLEAVED_A_B: _PixelFormatMetadata(
1407 string_value="BayerGB12_I_A_B",
1408 channels=(Channel.BAYER,),
1409 storage_bits_per_channel=12,
1410 allocated_bits_per_pixel=16,
1411 numpy_dtype="uint16",
1412 is_packed=False,
1413 is_interleaved=True,
1414 unpacked_format=PixelFormat.BAYER_GB_12_AB
1415 ),
1416
1417 PixelFormat.MONO_10_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1418 string_value="Mono10p_I_A_B",
1419 channels=(Channel.INTENSITY,),
1420 storage_bits_per_channel=10,
1421 allocated_bits_per_pixel=10,
1422 numpy_dtype="uint8",
1423 is_packed=True,
1424 is_interleaved=True,
1425 unpacked_format=PixelFormat.MONO_10_AB
1426 ),
1427
1428 PixelFormat.BAYER_RG_10_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1429 string_value="BayerRG10p_I_A_B",
1430 channels=(Channel.BAYER,),
1431 storage_bits_per_channel=10,
1432 allocated_bits_per_pixel=10,
1433 numpy_dtype="uint8",
1434 is_packed=True,
1435 is_interleaved=True,
1436 unpacked_format=PixelFormat.BAYER_RG_10_AB
1437 ),
1438
1439 PixelFormat.BAYER_BG_10_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1440 string_value="BayerBG10p_I_A_B",
1441 channels=(Channel.BAYER,),
1442 storage_bits_per_channel=10,
1443 allocated_bits_per_pixel=10,
1444 numpy_dtype="uint8",
1445 is_packed=True,
1446 is_interleaved=True,
1447 unpacked_format=PixelFormat.BAYER_BG_10_AB
1448 ),
1449
1450 PixelFormat.BAYER_GR_10_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1451 string_value="BayerGR10p_I_A_B",
1452 channels=(Channel.BAYER,),
1453 storage_bits_per_channel=10,
1454 allocated_bits_per_pixel=10,
1455 numpy_dtype="uint8",
1456 is_packed=True,
1457 is_interleaved=True,
1458 unpacked_format=PixelFormat.BAYER_GR_10_AB
1459 ),
1460
1461 PixelFormat.BAYER_GB_10_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1462 string_value="BayerGB10p_I_A_B",
1463 channels=(Channel.BAYER,),
1464 storage_bits_per_channel=10,
1465 allocated_bits_per_pixel=10,
1466 numpy_dtype="uint8",
1467 is_packed=True,
1468 is_interleaved=True,
1469 unpacked_format=PixelFormat.BAYER_GB_10_AB
1470 ),
1471
1472 PixelFormat.MONO_12_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1473 string_value="Mono12p_I_A_B",
1474 channels=(Channel.INTENSITY,),
1475 storage_bits_per_channel=12,
1476 allocated_bits_per_pixel=12,
1477 numpy_dtype="uint8",
1478 is_packed=True,
1479 is_interleaved=True,
1480 unpacked_format=PixelFormat.MONO_12_AB
1481 ),
1482
1483 PixelFormat.BAYER_RG_12_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1484 string_value="BayerRG12p_I_A_B",
1485 channels=(Channel.BAYER,),
1486 storage_bits_per_channel=12,
1487 allocated_bits_per_pixel=12,
1488 numpy_dtype="uint8",
1489 is_packed=True,
1490 is_interleaved=True,
1491 unpacked_format=PixelFormat.BAYER_RG_12_AB
1492 ),
1493
1494 PixelFormat.BAYER_BG_12_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1495 string_value="BayerBG12p_I_A_B",
1496 channels=(Channel.BAYER,),
1497 storage_bits_per_channel=12,
1498 allocated_bits_per_pixel=12,
1499 numpy_dtype="uint8",
1500 is_packed=True,
1501 is_interleaved=True,
1502 unpacked_format=PixelFormat.BAYER_BG_12_AB
1503 ),
1504
1505 PixelFormat.BAYER_GR_12_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1506 string_value="BayerGR12p_I_A_B",
1507 channels=(Channel.BAYER,),
1508 storage_bits_per_channel=12,
1509 allocated_bits_per_pixel=12,
1510 numpy_dtype="uint8",
1511 is_packed=True,
1512 is_interleaved=True,
1513 unpacked_format=PixelFormat.BAYER_GR_12_AB
1514 ),
1515
1516 PixelFormat.BAYER_GB_12_PACKED_INTERLEAVED_A_B: _PixelFormatMetadata(
1517 string_value="BayerGB12p_I_A_B",
1518 channels=(Channel.BAYER,),
1519 storage_bits_per_channel=12,
1520 allocated_bits_per_pixel=12,
1521 numpy_dtype="uint8",
1522 is_packed=True,
1523 is_interleaved=True,
1524 unpacked_format=PixelFormat.BAYER_GB_12_AB
1525 ),
1526
1527 PixelFormat.MONO_8_INTERLEAVED_AB_CD: _PixelFormatMetadata(
1528 string_value="Mono8_I_AB_CD",
1529 channels=(Channel.INTENSITY,),
1530 storage_bits_per_channel=8,
1531 allocated_bits_per_pixel=8,
1532 numpy_dtype="uint8",
1533 is_packed=False,
1534 is_interleaved=True,
1535 unpacked_format=PixelFormat.MONO_8_ABCD
1536 ),
1537
1538 PixelFormat.MONO_10_INTERLEAVED_AB_CD: _PixelFormatMetadata(
1539 string_value="Mono10_I_AB_CD",
1540 channels=(Channel.INTENSITY,),
1541 storage_bits_per_channel=10,
1542 allocated_bits_per_pixel=16,
1543 numpy_dtype="uint16",
1544 is_packed=False,
1545 is_interleaved=True,
1546 unpacked_format=PixelFormat.MONO_10_ABCD
1547 ),
1548
1549 PixelFormat.MONO_12_INTERLEAVED_AB_CD: _PixelFormatMetadata(
1550 string_value="Mono12_I_AB_CD",
1551 channels=(Channel.INTENSITY,),
1552 storage_bits_per_channel=12,
1553 allocated_bits_per_pixel=16,
1554 numpy_dtype="uint16",
1555 is_packed=False,
1556 is_interleaved=True,
1557 unpacked_format=PixelFormat.MONO_12_ABCD
1558 ),
1559
1560 PixelFormat.MONO_10_PACKED_INTERLEAVED_AB_CD: _PixelFormatMetadata(
1561 string_value="Mono10p_I_AB_CD",
1562 channels=(Channel.INTENSITY,),
1563 storage_bits_per_channel=10,
1564 allocated_bits_per_pixel=10,
1565 numpy_dtype="uint8",
1566 is_packed=True,
1567 is_interleaved=True,
1568 unpacked_format=PixelFormat.MONO_10_ABCD
1569 ),
1570
1571 PixelFormat.MONO_12_PACKED_INTERLEAVED_AB_CD: _PixelFormatMetadata(
1572 string_value="Mono12p_I_AB_CD",
1573 channels=(Channel.INTENSITY,),
1574 storage_bits_per_channel=12,
1575 allocated_bits_per_pixel=12,
1576 numpy_dtype="uint8",
1577 is_packed=True,
1578 is_interleaved=True,
1579 unpacked_format=PixelFormat.MONO_12_ABCD
1580 ),
1581
1582 PixelFormat.MONO_10_GROUPED_40_IDS_INTERLEAVED_AB_CD: _PixelFormatMetadata(
1583 string_value="Mono10g40IDS_I_AB_CD",
1584 channels=(Channel.INTENSITY,),
1585 storage_bits_per_channel=10,
1586 allocated_bits_per_pixel=10,
1587 numpy_dtype="uint8",
1588 is_packed=True,
1589 is_interleaved=True,
1590 unpacked_format=PixelFormat.MONO_10_ABCD
1591 ),
1592
1593 PixelFormat.MONO_12_GROUPED_24_IDS_INTERLEAVED_AB_CD: _PixelFormatMetadata(
1594 string_value="Mono12g24IDS_I_AB_CD",
1595 channels=(Channel.INTENSITY,),
1596 storage_bits_per_channel=12,
1597 allocated_bits_per_pixel=12,
1598 numpy_dtype="uint8",
1599 is_packed=True,
1600 is_interleaved=True,
1601 unpacked_format=PixelFormat.MONO_12_ABCD
1602 ),
1603
1604 PixelFormat.MONO_10_AB: _PixelFormatMetadata(
1605 string_value="Mono10_AB",
1606 channels=(Channel.INTENSITY, Channel.INTENSITY),
1607 storage_bits_per_channel=10,
1608 allocated_bits_per_pixel=32,
1609 numpy_dtype="uint16",
1610 is_packed=False,
1611 is_interleaved=False,
1612 unpacked_format=PixelFormat.MONO_10_AB
1613 ),
1614
1615 PixelFormat.BAYER_RG_10_AB: _PixelFormatMetadata(
1616 string_value="BayerRG10_AB",
1617 channels=(Channel.BAYER, Channel.BAYER),
1618 storage_bits_per_channel=10,
1619 allocated_bits_per_pixel=32,
1620 numpy_dtype="uint16",
1621 is_packed=False,
1622 is_interleaved=False,
1623 unpacked_format=PixelFormat.BAYER_RG_10_AB
1624 ),
1625
1626 PixelFormat.BAYER_BG_10_AB: _PixelFormatMetadata(
1627 string_value="BayerBG10_AB",
1628 channels=(Channel.BAYER, Channel.BAYER),
1629 storage_bits_per_channel=10,
1630 allocated_bits_per_pixel=32,
1631 numpy_dtype="uint16",
1632 is_packed=False,
1633 is_interleaved=False,
1634 unpacked_format=PixelFormat.BAYER_BG_10_AB
1635 ),
1636
1637 PixelFormat.BAYER_GR_10_AB: _PixelFormatMetadata(
1638 string_value="BayerGR10_AB",
1639 channels=(Channel.BAYER, Channel.BAYER),
1640 storage_bits_per_channel=10,
1641 allocated_bits_per_pixel=32,
1642 numpy_dtype="uint16",
1643 is_packed=False,
1644 is_interleaved=False,
1645 unpacked_format=PixelFormat.BAYER_GR_10_AB
1646 ),
1647
1648 PixelFormat.BAYER_GB_10_AB: _PixelFormatMetadata(
1649 string_value="BayerGB10_AB",
1650 channels=(Channel.BAYER, Channel.BAYER),
1651 storage_bits_per_channel=10,
1652 allocated_bits_per_pixel=32,
1653 numpy_dtype="uint16",
1654 is_packed=False,
1655 is_interleaved=False,
1656 unpacked_format=PixelFormat.BAYER_GB_10_AB
1657 ),
1658
1659 PixelFormat.MONO_12_AB: _PixelFormatMetadata(
1660 string_value="Mono12_AB",
1661 channels=(Channel.INTENSITY, Channel.INTENSITY),
1662 storage_bits_per_channel=12,
1663 allocated_bits_per_pixel=32,
1664 numpy_dtype="uint16",
1665 is_packed=False,
1666 is_interleaved=False,
1667 unpacked_format=PixelFormat.MONO_12_AB
1668 ),
1669
1670 PixelFormat.BAYER_RG_12_AB: _PixelFormatMetadata(
1671 string_value="BayerRG12_AB",
1672 channels=(Channel.BAYER, Channel.BAYER),
1673 storage_bits_per_channel=12,
1674 allocated_bits_per_pixel=32,
1675 numpy_dtype="uint16",
1676 is_packed=False,
1677 is_interleaved=False,
1678 unpacked_format=PixelFormat.BAYER_RG_12_AB
1679 ),
1680
1681 PixelFormat.BAYER_BG_12_AB: _PixelFormatMetadata(
1682 string_value="BayerBG12_AB",
1683 channels=(Channel.BAYER, Channel.BAYER),
1684 storage_bits_per_channel=12,
1685 allocated_bits_per_pixel=32,
1686 numpy_dtype="uint16",
1687 is_packed=False,
1688 is_interleaved=False,
1689 unpacked_format=PixelFormat.BAYER_BG_12_AB
1690 ),
1691
1692 PixelFormat.BAYER_GR_12_AB: _PixelFormatMetadata(
1693 string_value="BayerGR12_AB",
1694 channels=(Channel.BAYER, Channel.BAYER),
1695 storage_bits_per_channel=12,
1696 allocated_bits_per_pixel=32,
1697 numpy_dtype="uint16",
1698 is_packed=False,
1699 is_interleaved=False,
1700 unpacked_format=PixelFormat.BAYER_GR_12_AB
1701 ),
1702
1703 PixelFormat.BAYER_GB_12_AB: _PixelFormatMetadata(
1704 string_value="BayerGB12_AB",
1705 channels=(Channel.BAYER, Channel.BAYER),
1706 storage_bits_per_channel=12,
1707 allocated_bits_per_pixel=32,
1708 numpy_dtype="uint16",
1709 is_packed=False,
1710 is_interleaved=False,
1711 unpacked_format=PixelFormat.BAYER_GB_12_AB
1712 ),
1713
1714 PixelFormat.MONO_8_AB: _PixelFormatMetadata(
1715 string_value="Mono8_AB",
1716 channels=(Channel.INTENSITY, Channel.INTENSITY),
1717 storage_bits_per_channel=8,
1718 allocated_bits_per_pixel=16,
1719 numpy_dtype="uint8",
1720 is_packed=False,
1721 is_interleaved=False,
1722 unpacked_format=PixelFormat.MONO_8_AB
1723 ),
1724
1725 PixelFormat.BAYER_RG_8_AB: _PixelFormatMetadata(
1726 string_value="BayerRG8_AB",
1727 channels=(Channel.BAYER, Channel.BAYER),
1728 storage_bits_per_channel=8,
1729 allocated_bits_per_pixel=16,
1730 numpy_dtype="uint8",
1731 is_packed=False,
1732 is_interleaved=False,
1733 unpacked_format=PixelFormat.BAYER_RG_8_AB
1734 ),
1735
1736 PixelFormat.BAYER_BG_8_AB: _PixelFormatMetadata(
1737 string_value="BayerBG8_AB",
1738 channels=(Channel.BAYER, Channel.BAYER),
1739 storage_bits_per_channel=8,
1740 allocated_bits_per_pixel=16,
1741 numpy_dtype="uint8",
1742 is_packed=False,
1743 is_interleaved=False,
1744 unpacked_format=PixelFormat.BAYER_BG_8_AB
1745 ),
1746
1747 PixelFormat.BAYER_GR_8_AB: _PixelFormatMetadata(
1748 string_value="BayerGR8_AB",
1749 channels=(Channel.BAYER, Channel.BAYER),
1750 storage_bits_per_channel=8,
1751 allocated_bits_per_pixel=16,
1752 numpy_dtype="uint8",
1753 is_packed=False,
1754 is_interleaved=False,
1755 unpacked_format=PixelFormat.BAYER_GR_8_AB
1756 ),
1757
1758 PixelFormat.BAYER_GB_8_AB: _PixelFormatMetadata(
1759 string_value="BayerGB8_AB",
1760 channels=(Channel.BAYER, Channel.BAYER),
1761 storage_bits_per_channel=8,
1762 allocated_bits_per_pixel=16,
1763 numpy_dtype="uint8",
1764 is_packed=False,
1765 is_interleaved=False,
1766 unpacked_format=PixelFormat.BAYER_GB_8_AB
1767 ),
1768
1769 PixelFormat.MONO_8_ABCD: _PixelFormatMetadata(
1770 string_value="Mono8_ABCD",
1771 channels=(Channel.INTENSITY, Channel.INTENSITY, Channel.INTENSITY, Channel.INTENSITY),
1772 storage_bits_per_channel=8,
1773 allocated_bits_per_pixel=32,
1774 numpy_dtype="uint8",
1775 is_packed=False,
1776 is_interleaved=False,
1777 unpacked_format=PixelFormat.MONO_8_ABCD
1778 ),
1779
1780 PixelFormat.MONO_10_ABCD: _PixelFormatMetadata(
1781 string_value="Mono10_ABCD",
1782 channels=(Channel.INTENSITY, Channel.INTENSITY, Channel.INTENSITY, Channel.INTENSITY),
1783 storage_bits_per_channel=10,
1784 allocated_bits_per_pixel=64,
1785 numpy_dtype="uint16",
1786 is_packed=False,
1787 is_interleaved=False,
1788 unpacked_format=PixelFormat.MONO_10_ABCD
1789 ),
1790
1791 PixelFormat.MONO_12_ABCD: _PixelFormatMetadata(
1792 string_value="Mono12_ABCD",
1793 channels=(Channel.INTENSITY, Channel.INTENSITY, Channel.INTENSITY, Channel.INTENSITY),
1794 storage_bits_per_channel=12,
1795 allocated_bits_per_pixel=64,
1796 numpy_dtype="uint16",
1797 is_packed=False,
1798 is_interleaved=False,
1799 unpacked_format=PixelFormat.MONO_12_ABCD
1800 ),
1801}
Enum listing all supported pixel formats and their internal IDs.
int allocated_bits_per_pixel(self)
Returns the number of allocated bits per pixel.
bool has_intensity_channel(self)
Returns True if the pixel format has an intensity channel.
str numpy_dtype(self)
Returns the numpy dtype string for this pixel format.
int get_size_in_bytes(self, Size size)
Calculates the memory size in bytes for a given image size.
Union[int, float] maximum_value_per_channel(self)
Returns the maximum possible value per channel for the pixel format.
bool is_interleaved(self)
Indicates whether the pixel format is interleaved.
Union[int, float] minimum_value_per_channel(self)
Returns the minimum possible value per channel for the pixel format.
int storage_bits_per_pixel(self)
Returns the total number of bits used per pixel for storage.
PixelFormat unpacked_format(self)
Returns the unpacked pixel format for a packed pixel format.
bool is_packed(self)
Returns True if the pixel format is packed.
str string_value(self)
Returns the human-readable name of the pixel format.
int storage_bits_per_channel(self)
Returns the number of bits used per channel for storage.
bool has_channel(self, Channel channel)
Returns True if the pixel format has a specific channel.
Tuple[Channel,...] channels(self)
Returns the list of channels in the pixel format.
str __str__(self)
Return a human-readable string of the PixelFormat object.
int number_of_channels(self)
Returns the total number of channels in the pixel format.
str __repr__(self)
Return an unambiguous string of the PixelFormat object.
bool is_single_channel(self)
Returns True if the pixel format has only a single channel.
int get_channel_index(self, Channel channel)
Returns the index of a specific channel within the pixel format.