MCPcopy Create free account
hub / github.com/RustCV/RustCV / PixelFormat

Enum PixelFormat

rustcv-camera/src/pixel_format.rs:22–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20/// - `Other(u32)` 保留了对未知格式的扩展性
21#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22pub enum PixelFormat {
23 /// Motion JPEG compressed format.
24 /// Most common compressed format for USB cameras.
25 /// Low bandwidth, requires CPU decoding.
26 ///
27 /// Motion JPEG 压缩格式。
28 /// USB 摄像头最常见的压缩格式。带宽低,需要 CPU 解码。
29 Mjpeg,
30
31 /// YUYV 4:2:2 uncompressed format.
32 /// Most common uncompressed format for USB cameras.
33 /// 2 bytes per pixel, simple CPU conversion to BGR.
34 ///
35 /// YUYV 4:2:2 无压缩格式。
36 /// USB 摄像头最常见的无压缩格式。每像素 2 字节,CPU 转换为 BGR 简单。
37 Yuyv,
38
39 /// NV12 (YUV 4:2:0 semi-planar) format.
40 /// Common on mobile/embedded devices.
41 /// 1.5 bytes per pixel.
42 ///
43 /// NV12(YUV 4:2:0 半平面)格式。
44 /// 常见于手机/嵌入式设备。每像素 1.5 字节。
45 Nv12,
46
47 /// BGR 24-bit format (Blue-Green-Red).
48 /// OpenCV's default channel order. Already decoded, no conversion needed.
49 ///
50 /// BGR 24 位格式(蓝-绿-红)。
51 /// OpenCV 默认的通道顺序。已解码,无需转换。
52 Bgr24,
53
54 /// RGB 24-bit format (Red-Green-Blue).
55 /// Standard display order. Needs channel swap for OpenCV compatibility.
56 ///
57 /// RGB 24 位格式(红-绿-蓝)。
58 /// 标准显示顺序。需要通道交换以兼容 OpenCV。
59 Rgb24,
60
61 /// BGRA 32-bit format (Blue-Green-Red-Alpha, 4 bytes per pixel).
62 /// Native output from macOS AVFoundation (kCVPixelFormatType_32BGRA).
63 /// The Alpha channel is ignored during decode; only BGR is used.
64 ///
65 /// BGRA 32 位格式(蓝-绿-红-透明度,每像素 4 字节)。
66 /// macOS AVFoundation 的原生输出格式(kCVPixelFormatType_32BGRA)。
67 /// 解码时忽略 Alpha 通道,仅使用 BGR。
68 Bgra32,
69
70 /// Unknown or unsupported format, stored as raw FourCC value.
71 /// 未知或不支持的格式,存储为原始 FourCC 值。
72 Other(u32),
73}
74
75/// Helper macro to build a FourCC u32 from 4 ASCII bytes.
76/// 辅助宏:从 4 个 ASCII 字节构造 FourCC u32 值。

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected