image-rs / imageproc

Image processing operations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to convert Canny to rgba for canvas drawing?

tetap opened this issue · comments

commented
How to convert Canny to rgba for canvas drawing?
commented

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

commented

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

commented

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.