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

Function main

rustcv-camera/examples/resolution_bench.rs:25–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
26 let tests = [
27 ResolutionTest {
28 width: 640,
29 height: 480,
30 label: "480p",
31 },
32 ResolutionTest {
33 width: 1280,
34 height: 720,
35 label: "720p",
36 },
37 ResolutionTest {
38 width: 1920,
39 height: 1080,
40 label: "1080p",
41 },
42 ];
43
44 let mut results: Vec<(&str, u32, u32, f64, String)> = Vec::new();
45
46 for test in &tests {
47 println!(
48 "\n=== Testing {} ({}x{}) ===",
49 test.label, test.width, test.height
50 );
51
52 match run_resolution_test(test) {
53 Ok((fps, format)) => {
54 println!(" Result: {:.1} fps ({})", fps, format);
55 results.push((test.label, test.width, test.height, fps, format));
56 }
57 Err(e) => {
58 println!(" Skipped: {}", e);
59 results.push((test.label, test.width, test.height, 0.0, "N/A".into()));
60 }
61 }
62 }
63
64 // Print summary table.
65 // 打印汇总表。
66 println!("\n╔══════════╦════════════════╦══════════╦══════════╗");
67 println!("║ Resolution ║ Actual ║ FPS ║ Format ║");
68 println!("╠══════════╬════════════════╬══════════╬══════════╣");
69 for (label, w, h, fps, fmt) in &results {
70 println!(
71 "║ {:<8} ║ {:>5}x{:<5} ║ {:>6.1} ║ {:<8} ║",
72 label, w, h, fps, fmt
73 );
74 }
75 println!("╚══════════╩════════════════╩══════════╩══════════╝");
76
77 Ok(())
78}
79
80/// Run a single resolution test with live preview window.
81/// 运行单次分辨率测试,带实时预览窗口。

Callers

nothing calls this directly

Calls 1

run_resolution_testFunction · 0.85

Tested by

no test coverage detected