image-rs / imageproc

Image processing operations
MIT License
736 stars 145 forks source link

Fix Gaussian blur loosing value by normalizing the finite Gaussian kernel. #528

Closed stephanemagnenat closed 4 months ago

stephanemagnenat commented 1 year ago

This corrects issue #529 by re-normalizing the Gaussian kernel. This breaks regression tests based on existing images, obviously.

stephanemagnenat commented 1 year ago

Of course, if we want compatibility, we could keep the current functions as is and add _normalized versions.

theotherphil commented 6 months ago

Thanks for the PR.

Please can you move the new tests you've added to regression.rs into the tests section of src/mod/filter.rs, and regenerate the expected outputs for the existing gaussian blur tests in regression.rs by running cargo test with the REGENERATE environment variable set: https://github.com/image-rs/imageproc/blob/4060ac1b28c694b66c4e28fb76d66685c1971647/tests/regression.rs#L8.

theotherphil commented 4 months ago

This is a useful fix and I suspect that I ignored the PR for long enough for @stephanemagnenat to lose interest! So I’ll merge as is and then fix the tests in a follow up PR.

stephanemagnenat commented 4 months ago

Sorry I am busy with professional deadlines these days, feel free to merge anything that is helpful :-)