mirror of
https://github.com/l1npengtul/nokhwa.git
synced 2026-07-13 21:48:53 +00:00
fix example
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## capture
|
||||
Capture is a command line application designed to test features of backends to see if they are implemented correctly.
|
||||
For the UVC backend, you may need to run the app as admin.
|
||||
NOTE: Network Camera support is currently broken.
|
||||
|
||||
### Capture - Usage
|
||||
`<>` indicates an optional parameter. `[]` indicates a mandatory one.
|
||||
|
||||
@@ -4,7 +4,7 @@ use glium::{
|
||||
IndexBuffer, Surface, Texture2d, VertexBuffer,
|
||||
};
|
||||
use glutin::{event_loop::EventLoop, window::WindowBuilder, ContextBuilder};
|
||||
use nokhwa::{query_devices, Camera, CaptureAPIBackend, FrameFormat, NetworkCamera};
|
||||
use nokhwa::{query_devices, Camera, CaptureAPIBackend, FrameFormat};
|
||||
use std::time::Instant;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
@@ -195,21 +195,22 @@ fn main() {
|
||||
}
|
||||
// IP Camera
|
||||
else {
|
||||
let ip_camera =
|
||||
NetworkCamera::new(matches_clone.value_of("capture").unwrap().to_string())
|
||||
.expect("Invalid IP!");
|
||||
ip_camera.open_stream().unwrap();
|
||||
loop {
|
||||
let frame = ip_camera.frame().unwrap();
|
||||
println!(
|
||||
"Captured frame {}x{} @ {}FPS size {}",
|
||||
frame.width(),
|
||||
frame.height(),
|
||||
fps,
|
||||
frame.len()
|
||||
);
|
||||
send.send(frame).unwrap();
|
||||
}
|
||||
// let ip_camera =
|
||||
// NetworkCamera::new(matches_clone.value_of("capture").unwrap().to_string())
|
||||
// .expect("Invalid IP!");
|
||||
// ip_camera.open_stream().unwrap();
|
||||
// loop {
|
||||
// let frame = ip_camera.frame().unwrap();
|
||||
// println!(
|
||||
// "Captured frame {}x{} @ {}FPS size {}",
|
||||
// frame.width(),
|
||||
// frame.height(),
|
||||
// fps,
|
||||
// frame.len()
|
||||
// );
|
||||
// send.send(frame).unwrap();
|
||||
// }
|
||||
panic!("Network camera support is currently not implemented!");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user