Closed michelerenzullo closed 2 years ago
Thank you for noticing this. I've run into integer rounding issues before, and had fixed the problem in the code at one point, but it was lost in subsequent changes. The latest commit solves the problem for the two exposed border policies and for any integral type:
Let me know if it fits your needs before I close the issue.
That's should be perfect, what I thought, dealing with uchar or uint16_t or any integral... I will try in a bit thanks
when you multiply the output with float "iarr" and "T" is uchar you should add +0.5f to round it, otherwise the output will be slighty darker, I suggest to add a constexpr to check if T is uchar and so round it, if you do that the output is as expected to be.
https://github.com/bfraboni/FastGaussianBlur/blob/fabc47f62a53a201e685a78e15320aba6e341cfd/fast_gaussian_blur_template.h#L99
GOOD - opencv blur as reference: GOOD - Uchar rounded: BAD - Uchar not rounded