imageproc icon indicating copy to clipboard operation
imageproc copied to clipboard

`imageproc::edges::canny` panics when thresholds are both 0.0

Open jyi2ya opened this issue 1 year ago • 0 comments

    let image = image::GrayImage::new(10, 10);
    let edges = imageproc::edges::canny(&image, 0.0, 0.0);

result

thread 'main' panicked at /home/jyi/.cargo/git/checkouts/imageproc-15e7df7e968bb8fb/ab9e19c/src/edges.rs:135:26:
attempt to subtract with overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/std/src/panicking.rs:681:5
   1: core::panicking::panic_fmt
             at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/core/src/panicking.rs:75:14
   2: core::panicking::panic_const::panic_const_sub_overflow
             at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/core/src/panicking.rs:178:21
   3: imageproc::edges::hysteresis
   4: imageproc::edges::canny
             at /home/jyi/.cargo/git/checkouts/imageproc-15e7df7e968bb8fb/ab9e19c/src/edges.rs:52:5
   5: vic::baka
             at ./src/main.rs:1021:17
   6: vic::main
             at ./src/main.rs:1030:5
   7: core::ops::function::FnOnce::call_once
             at /home/jyi/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

jyi2ya avatar Jan 06 '25 20:01 jyi2ya