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

Function rgb_to_bgr

rustcv-camera/src/decode.rs:213–219  ·  view source on GitHub ↗

Swap R and B channels: RGB24 → BGR24. 交换 R 和 B 通道:RGB24 → BGR24。

(src: &[u8], dst: &mut [u8])

Source from the content-addressed store, hash-verified

211/// Swap R and B channels: RGB24 → BGR24.
212/// 交换 R 和 B 通道:RGB24 → BGR24。
213fn rgb_to_bgr(src: &[u8], dst: &mut [u8]) {
214 for (s, d) in src.chunks_exact(3).zip(dst.chunks_exact_mut(3)) {
215 d[0] = s[2]; // B ← R
216 d[1] = s[1]; // G ← G
217 d[2] = s[0]; // R ← B
218 }
219}
220
221// ─── Helpers ────────────────────────────────────────────────────────────────
222

Callers 2

decode_frameFunction · 0.85
rgb_to_bgr_swapFunction · 0.85

Calls

no outgoing calls

Tested by 1

rgb_to_bgr_swapFunction · 0.68