#[non_exhaustive]#[repr(u32)]pub enum PixelFormat {
Show 62 variants
Mono8 = 17_301_505,
Mono10 = 17_825_795,
Mono12 = 17_825_797,
Mono14 = 17_825_829,
Mono16 = 17_825_799,
Mono10p = 17_432_646,
Mono12p = 17_563_719,
Mono10Packed = 17_563_652,
Mono12Packed = 17_563_654,
Confidence8 = 17_301_702,
Coord3DC16 = 17_825_976,
Coord3DC32f = 18_874_559,
Coord3DAC16 = 35_651_771,
Coord3DAC32f = 37_748_930,
Coord3DABC32f = 39_846_080,
BayerGR8 = 17_301_512,
BayerRG8 = 17_301_513,
BayerGB8 = 17_301_514,
BayerBG8 = 17_301_515,
BayerGR10 = 17_825_804,
BayerRG10 = 17_825_805,
BayerGB10 = 17_825_806,
BayerBG10 = 17_825_807,
BayerGR12 = 17_825_808,
BayerRG12 = 17_825_809,
BayerGB12 = 17_825_810,
BayerBG12 = 17_825_811,
BayerGR16 = 17_825_838,
BayerRG16 = 17_825_839,
BayerGB16 = 17_825_840,
BayerBG16 = 17_825_841,
BayerGR10p = 17_432_662,
BayerRG10p = 17_432_664,
BayerGB10p = 17_432_660,
BayerBG10p = 17_432_658,
BayerGR12p = 17_563_735,
BayerRG12p = 17_563_737,
BayerGB12p = 17_563_733,
BayerBG12p = 17_563_731,
BayerGR10Packed = 17_563_686,
BayerRG10Packed = 17_563_687,
BayerGB10Packed = 17_563_688,
BayerBG10Packed = 17_563_689,
BayerGR12Packed = 17_563_690,
BayerRG12Packed = 17_563_691,
BayerGB12Packed = 17_563_692,
BayerBG12Packed = 17_563_693,
RGB8Packed = 35_127_316,
BGR8Packed = 35_127_317,
RGBa8 = 35_651_606,
BGRa8 = 35_651_607,
YUV411_8_UYYVYY = 34_340_894,
YUV422_8_UYVY = 34_603_039,
YUV422_8 = 34_603_058,
YCbCr422_8 = 34_603_067,
YCbCr422_8_CbYCrY = 34_603_075,
YUV8_UYV = 35_127_328,
YCbCr8_CbYCr = 35_127_354,
YCbCr8 = 35_127_387,
VendorLucidEvsEvt30 = 2_165_313_072,
VendorLucidEvsEvt21 = 2_168_458_785,
Unknown(u32),
}Expand description
Enumeration of the pixel formats supported by the helper routines.
Codes are those of EMVA’s GenICam Pixel Format Names and Values (7 October 2025), the table PFNC 2.4 Appendix C refers to.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Mono8 = 17_301_505
PFNC Mono8, code 0x0108_0001.
Mono10 = 17_825_795
PFNC Mono10, code 0x0110_0003.
Mono12 = 17_825_797
PFNC Mono12, code 0x0110_0005.
Mono14 = 17_825_829
PFNC Mono14, code 0x0110_0025.
Mono16 = 17_825_799
PFNC Mono16, code 0x0110_0007.
Mono10p = 17_432_646
10-bit monochrome, PFNC lsb packed: four pixels in five bytes, filled
from bit 0 of byte 0 (PFNC 2.4 §6.3.1, Figure 6-9).
PFNC Mono10p, code 0x010A_0046.
Mono12p = 17_563_719
12-bit monochrome, PFNC lsb packed: two pixels in three bytes, filled
from bit 0 of byte 0 (PFNC 2.4 §6.3.1).
PFNC Mono12p, code 0x010C_0047.
Mono10Packed = 17_563_652
10-bit monochrome in the GigE Vision 2.0 layout: two pixels in three
bytes, the eight most significant bits of each in bytes 0 and 2, the
two least significant bits in bits 1-0 and 5-4 of byte 1.
PFNC Mono10Packed, code 0x010C_0004.
Mono12Packed = 17_563_654
12-bit monochrome in the GigE Vision 2.0 layout: two pixels in three
bytes, the eight most significant bits of each in bytes 0 and 2, the
four least significant bits in the low and high nibble of byte 1. Not
the bit order of PixelFormat::Mono12p.
EMVA’s values table assigns the code to GigE Vision 2.0, whose text is
not public; the layout is the one Teledyne FLIR documents for its
cameras (“Understanding Pixel Formats”), as for
PixelFormat::Mono10Packed.
PFNC Mono12Packed, code 0x010C_0006.
Confidence8 = 17_301_702
PFNC Confidence8, code 0x0108_00C6.
Coord3DC16 = 17_825_976
PFNC Coord3DC16, code 0x0110_00B8.
Coord3DC32f = 18_874_559
PFNC Coord3DC32f, code 0x0120_00BF.
Coord3DAC16 = 35_651_771
PFNC Coord3DAC16, code 0x0220_00BB.
Coord3DAC32f = 37_748_930
PFNC Coord3DAC32f, code 0x0240_00C2.
Coord3DABC32f = 39_846_080
PFNC Coord3DABC32f, code 0x0260_00C0.
BayerGR8 = 17_301_512
PFNC BayerGR8, code 0x0108_0008.
BayerRG8 = 17_301_513
PFNC BayerRG8, code 0x0108_0009.
BayerGB8 = 17_301_514
PFNC BayerGB8, code 0x0108_000A.
BayerBG8 = 17_301_515
PFNC BayerBG8, code 0x0108_000B.
BayerGR10 = 17_825_804
PFNC BayerGR10, code 0x0110_000C.
BayerRG10 = 17_825_805
PFNC BayerRG10, code 0x0110_000D.
BayerGB10 = 17_825_806
PFNC BayerGB10, code 0x0110_000E.
BayerBG10 = 17_825_807
PFNC BayerBG10, code 0x0110_000F.
BayerGR12 = 17_825_808
PFNC BayerGR12, code 0x0110_0010.
BayerRG12 = 17_825_809
PFNC BayerRG12, code 0x0110_0011.
BayerGB12 = 17_825_810
PFNC BayerGB12, code 0x0110_0012.
BayerBG12 = 17_825_811
PFNC BayerBG12, code 0x0110_0013.
BayerGR16 = 17_825_838
PFNC BayerGR16, code 0x0110_002E.
BayerRG16 = 17_825_839
PFNC BayerRG16, code 0x0110_002F.
BayerGB16 = 17_825_840
PFNC BayerGB16, code 0x0110_0030.
BayerBG16 = 17_825_841
PFNC BayerBG16, code 0x0110_0031.
BayerGR10p = 17_432_662
A Bayer mosaic packed as PixelFormat::Mono10p is.
PFNC BayerGR10p, code 0x010A_0056.
BayerRG10p = 17_432_664
A Bayer mosaic packed as PixelFormat::Mono10p is.
PFNC BayerRG10p, code 0x010A_0058.
BayerGB10p = 17_432_660
A Bayer mosaic packed as PixelFormat::Mono10p is.
PFNC BayerGB10p, code 0x010A_0054.
BayerBG10p = 17_432_658
A Bayer mosaic packed as PixelFormat::Mono10p is.
PFNC BayerBG10p, code 0x010A_0052.
BayerGR12p = 17_563_735
A Bayer mosaic packed as PixelFormat::Mono12p is.
PFNC BayerGR12p, code 0x010C_0057.
BayerRG12p = 17_563_737
A Bayer mosaic packed as PixelFormat::Mono12p is.
PFNC BayerRG12p, code 0x010C_0059.
BayerGB12p = 17_563_733
A Bayer mosaic packed as PixelFormat::Mono12p is.
PFNC BayerGB12p, code 0x010C_0055.
BayerBG12p = 17_563_731
A Bayer mosaic packed as PixelFormat::Mono12p is.
PFNC BayerBG12p, code 0x010C_0053.
BayerGR10Packed = 17_563_686
A Bayer mosaic packed as PixelFormat::Mono10Packed is.
PFNC BayerGR10Packed, code 0x010C_0026.
BayerRG10Packed = 17_563_687
A Bayer mosaic packed as PixelFormat::Mono10Packed is.
PFNC BayerRG10Packed, code 0x010C_0027.
BayerGB10Packed = 17_563_688
A Bayer mosaic packed as PixelFormat::Mono10Packed is.
PFNC BayerGB10Packed, code 0x010C_0028.
BayerBG10Packed = 17_563_689
A Bayer mosaic packed as PixelFormat::Mono10Packed is.
PFNC BayerBG10Packed, code 0x010C_0029.
BayerGR12Packed = 17_563_690
A Bayer mosaic packed as PixelFormat::Mono12Packed is.
PFNC BayerGR12Packed, code 0x010C_002A.
BayerRG12Packed = 17_563_691
A Bayer mosaic packed as PixelFormat::Mono12Packed is.
PFNC BayerRG12Packed, code 0x010C_002B.
BayerGB12Packed = 17_563_692
A Bayer mosaic packed as PixelFormat::Mono12Packed is.
PFNC BayerGB12Packed, code 0x010C_002C.
BayerBG12Packed = 17_563_693
A Bayer mosaic packed as PixelFormat::Mono12Packed is.
PFNC BayerBG12Packed, code 0x010C_002D.
RGB8Packed = 35_127_316
PFNC RGB8Packed, code 0x0218_0014.
BGR8Packed = 35_127_317
PFNC BGR8Packed, code 0x0218_0015.
RGBa8 = 35_651_606
RGB with a fourth, manufacturer-defined alpha byte.
PFNC RGBa8, code 0x0220_0016.
BGRa8 = 35_651_607
BGR with a fourth, manufacturer-defined alpha byte.
PFNC BGRa8, code 0x0220_0017.
YUV411_8_UYYVYY = 34_340_894
Y’CbCr 4:1:1, six bytes for four pixels in the order U Y Y V Y Y.
PFNC YUV411_8_UYYVYY, code 0x020C_001E.
YUV422_8_UYVY = 34_603_039
Y’CbCr 4:2:2, four bytes for two pixels in the order U Y V Y.
PFNC YUV422_8_UYVY, code 0x0210_001F.
YUV422_8 = 34_603_058
Y’CbCr 4:2:2, four bytes for two pixels in the order Y U Y V — the
PFNC default for 4:2:2 (PFNC 2.4 §3.1.3).
PFNC YUV422_8, code 0x0210_0032.
YCbCr422_8 = 34_603_067
Full-range Y’CbCr 4:2:2 in the order Y Cb Y Cr.
PFNC YCbCr422_8, code 0x0210_003B.
YCbCr422_8_CbYCrY = 34_603_075
Full-range Y’CbCr 4:2:2 in the order Cb Y Cr Y.
PFNC YCbCr422_8_CbYCrY, code 0x0210_0043.
YUV8_UYV = 35_127_328
Y’CbCr 4:4:4 in the order U Y V.
PFNC YUV8_UYV, code 0x0218_0020.
YCbCr8_CbYCr = 35_127_354
Full-range Y’CbCr 4:4:4 in the order Cb Y Cr.
PFNC YCbCr8_CbYCr, code 0x0218_003A.
YCbCr8 = 35_127_387
Full-range Y’CbCr 4:4:4 in the order Y Cb Cr.
PFNC YCbCr8, code 0x0218_005B.
VendorLucidEvsEvt30 = 2_165_313_072
Prophesee EVT 3.0 event stream, as a Lucid Triton2 EVS sends it (#139).
Vendor-defined, not PFNC: bit 31 of the code is set, which is how
PFNC marks a format outside its own table — hence the VendorLucid
prefix, so a Lucid extension cannot read as a standard format name.
The stream carries events,
not pixels, so PixelFormat::bytes_per_pixel answers the size of one
event word (16 bits) — the depth the code’s own bits 23-16 declare,
and the same answer PixelFormat::Unknown would derive for it. A
block’s length is not width * height times that.
PFNC VendorLucidEvsEvt30, code 0x8110_0E30.
VendorLucidEvsEvt21 = 2_168_458_785
Prophesee EVT 2.1 event stream, 64-bit event words. Vendor-defined; see
PixelFormat::VendorLucidEvsEvt30.
PFNC VendorLucidEvsEvt21, code 0x8140_0E21.
Unknown(u32)
Unknown PFNC code reported by the device.
Implementations§
Source§impl PixelFormat
impl PixelFormat
Sourcepub const fn from_code(code: u32) -> PixelFormat
pub const fn from_code(code: u32) -> PixelFormat
Convert a raw PFNC code into a PixelFormat enumeration.
Sourcepub fn from_name(name: &str) -> PixelFormat
pub fn from_name(name: &str) -> PixelFormat
Convert a pixel format name to a PixelFormat.
Accepts the PFNC name and the older spellings cameras still
report for the same code — YUV422Packed for YUV422_8_UYVY,
RGB8 for RGB8Packed. Returns PixelFormat::Unknown(0) for
unrecognised names.
Source§impl PixelFormat
impl PixelFormat
Sourcepub const fn bytes_per_pixel(self) -> Option<usize>
pub const fn bytes_per_pixel(self) -> Option<usize>
Number of bytes used to encode a single pixel.
Derived from bits 23-16 of the PFNC code, which carry the pixel’s bit
depth, so a format this enumeration does not name is sized too. None
means the pixel genuinely has no whole-byte size — a packed format —
not that we failed to look it up; PixelFormat::bits_per_pixel and
PixelFormat::image_bytes answer for those.
Sourcepub const fn bits_per_pixel(self) -> Option<u32>
pub const fn bits_per_pixel(self) -> Option<u32>
Bits one pixel occupies, from bits 23-16 of the PFNC code: 12 for
Mono12p and Mono12Packed, 16 for Mono12 (two bytes, four of them
padding) and for 4:2:2 Y’CbCr (an average over each pair of pixels).
None only for a code that declares no size, such as Unknown(0).
Sourcepub const fn line_bytes(self, width: u32) -> Option<usize>
pub const fn line_bytes(self, width: u32) -> Option<usize>
Bytes holding width pixels that start a packing group, the group
completed when width ends inside one.
PFNC 2.4 §6.7 completes a group the image or line ends inside with
zero-valued components, so Mono12p holds 3 bytes for one pixel as
for two. This is the length of one line under §6.7’s line padding.
None when PixelFormat::image_bytes is.
Sourcepub const fn image_bytes(self, width: u32, height: u32) -> Option<usize>
pub const fn image_bytes(self, width: u32, height: u32) -> Option<usize>
Bytes holding a width × height image whose pixels run on from one
line to the next without padding (PFNC 2.4 §6.7, image padding), the
last packing group completed with zero-valued pixels.
Equal to line_bytes(width) * height whenever width is a multiple of
the packing group: four pixels for 10p, two for 12p, 10Packed,
12Packed and 4:2:2, four for 4:1:1. None for an event stream, whose
leader fields are not image geometry, for a code that declares no size,
and for a size that overflows usize.
A camera may send a bit-packed image without completing that group;
convert’s Geometry section says what the converters accept.
Sourcepub const fn is_mono(self) -> bool
pub const fn is_mono(self) -> bool
Whether the pixel format is single-component monochrome (Mono*).
Sourcepub const fn cfa_pattern(self) -> Option<(&'static str, u8, u8)>
pub const fn cfa_pattern(self) -> Option<(&'static str, u8, u8)>
Return the Color Filter Array pattern and canonical offsets.
The tuple encodes (pattern, x_offset, y_offset) where the offsets
describe how the sensor mosaic aligns to the canonical "RGGB"
ordering: the pixel at (x, y) has the colour "RGGB" has at
(x + x_offset, y + y_offset). The first two letters of a Bayer name
are its top row (PFNC 2.4 §3.1.7): BayerGR is G R over B G.