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

Function bgr_to_u32

rustcv-camera/examples/resolution_bench.rs:143–150  ·  view source on GitHub ↗

Convert BGR byte slice to u32 display buffer (0x00RRGGBB). 将 BGR 字节切片转换为 u32 显示缓冲区(0x00RRGGBB)。

(bgr: &[u8], buf: &mut [u32])

Source from the content-addressed store, hash-verified

141/// Convert BGR byte slice to u32 display buffer (0x00RRGGBB).
142/// 将 BGR 字节切片转换为 u32 显示缓冲区(0x00RRGGBB)。
143fn bgr_to_u32(bgr: &[u8], buf: &mut [u32]) {
144 for (pixel, chunk) in buf.iter_mut().zip(bgr.chunks_exact(3)) {
145 let b = chunk[0] as u32;
146 let g = chunk[1] as u32;
147 let r = chunk[2] as u32;
148 *pixel = (r << 16) | (g << 8) | b;
149 }
150}
151
152/// Draw FPS and resolution label overlay.
153/// 绘制 FPS 和分辨率标签叠加。

Callers 1

run_resolution_testFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected