⭐ getting 1080p JPEG frames from my webcam @ 30 FPS
parent
3da0836c8a
commit
22d20afcda
12
src/main.rs
12
src/main.rs
|
@ -35,12 +35,20 @@ fn main() -> Result <(), Error>
|
||||||
let mut buf = vec! [0u8; cap.size_image ()];
|
let mut buf = vec! [0u8; cap.size_image ()];
|
||||||
let mut bytesused = 0;
|
let mut bytesused = 0;
|
||||||
|
|
||||||
for _ in 0..5
|
for _ in 0..30
|
||||||
|
{
|
||||||
|
cap.wait_for_frame (&mut buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
let start = Instant::now ();
|
||||||
|
for _ in 0..30
|
||||||
{
|
{
|
||||||
let rc = cap.wait_for_frame (&mut buf);
|
let rc = cap.wait_for_frame (&mut buf);
|
||||||
bytesused = rc.unwrap ();
|
bytesused = rc.unwrap ();
|
||||||
dbg! (bytesused);
|
|
||||||
}
|
}
|
||||||
|
let stop = Instant::now ();
|
||||||
|
|
||||||
|
dbg! (30_000.0f32 / (stop - start).as_millis () as f32);
|
||||||
|
|
||||||
let mut f = std::fs::File::create ("data.jpeg").unwrap ();
|
let mut f = std::fs::File::create ("data.jpeg").unwrap ();
|
||||||
f.write_all (&buf [0..bytesused]).unwrap ();
|
f.write_all (&buf [0..bytesused]).unwrap ();
|
||||||
|
|
Loading…
Reference in New Issue