Skip to content

imageproc::edges::canny panics when thresholds are both 0.0 #705

@jyi2ya

Description

@jyi2ya
    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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions