oli-obk / camera_capture

Crate for capturing images from a webcam
51 stars 18 forks source link

examples are failing #19

Open tpltnt opened 5 years ago

tpltnt commented 5 years ago

Hi there,

i tried the examples and got the following results:

Cheers, tpltnt

oli-obk commented 5 years ago

Hmm... this looks to me like a failure to find your webcam. I'm not sure I can debug this, since my hardware works.

tpltnt commented 5 years ago

Interesting. The problem actually seems to be on my end. I can use my webcam with a browser, but not via processing (as a quick test). Either way, a more graceful error-handling should help future users.

maurokenny commented 4 years ago

I've tried sudo apt-get install -y libv4l-dev and sudo apt-get install libjpeg-dev It resolves this problem but now I have another one:

 RUST_BACKTRACE=1 cargo run --example hello_camera
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/examples/hello_camera`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidFps([0.0])', examples/hello_camera.rs:5:15
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1504
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:511
  11: rust_begin_unwind
             at src/libstd/panicking.rs:419
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:111
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1268
  14: core::result::Result<T,E>::unwrap
             at /home/kenny/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/result.rs:1005
  15: hello_camera::main
             at examples/hello_camera.rs:5
  16: std::rt::lang_start::{{closure}}
             at /home/kenny/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:67
  17: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  18: std::panicking::try::do_call
             at src/libstd/panicking.rs:331
  19: std::panicking::try
             at src/libstd/panicking.rs:274
  20: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  21: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  22: std::rt::lang_start
             at /home/kenny/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:67
  23: main
  24: __libc_start_main
  25: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
maurokenny commented 4 years ago

I fixed this error increasing the number of frames as: let cam = cam.fps(30.0).unwrap().start().unwrap();

oli-obk commented 4 years ago

oh. I hardcoded a fps in the examples? Yea we should fix that. I don't remember how to extract the fps and don't have time right now to really dig into this crate again, but I'll happily accept PRs