image-rs / imageproc

Image processing operations
MIT License
735 stars 145 forks source link

Optimize `find_contours_with_threshold` #534

Closed cospectrum closed 6 months ago

cospectrum commented 1 year ago

Replace expensive allocation vec![vec![0i32; height]; width] with more efficient vec![0i32; height * width]

cospectrum commented 1 year ago

I tried with a couple of images, it's about 40% faster. And x + width * y indexing is faster than y + height * x

theotherphil commented 6 months ago

Thanks!