image-rs / imageproc

Image processing operations
MIT License
736 stars 145 forks source link

How to convert Canny to rgba for canvas drawing? #512

Closed tetap closed 1 year ago

tetap commented 1 year ago

I tried to save the image, but it looks like this image I tried to save the image, but it looks like this image Here's my code

    use imageproc::edges::canny;
    let image = ImageBuffer::from_raw(width, height, data.clone()).unwrap();
    let edges = DynamicImage::ImageLuma8(canny(&image, low_threshold, high_threshold));
    edges.save("img/result/test.jpg").unwrap();
    data.clone()

The final result did not agree with my expectation

tetap commented 1 year ago

This is what I got using OpenCV, and obviously he got the right edge. image

tetap commented 1 year ago

I'm sorry it's my fault, but canny I can't control the SIGMA value of gaussian_blur_f32. Can only be solved by modifying the source code.