Skip to content

Improved Gauss kernel generation#2844

Open
RunDevelopment wants to merge 1 commit intoimage-rs:mainfrom
RunDevelopment:impr-kernel-gen
Open

Improved Gauss kernel generation#2844
RunDevelopment wants to merge 1 commit intoimage-rs:mainfrom
RunDevelopment:impr-kernel-gen

Conversation

@RunDevelopment
Copy link
Member

Changes:

  • Added debug assertions to check assumptions in debug.
  • Define a minimum sigma of 0.01. This prevents division by zero.
  • Removed the scaling by $1/\sqrt{2\pi\sigma^2}$. Since kernel weights are normalized, this scaling is unnecessary.
  • Remove use of f32::powf and cache more divisions. The performance impact will likely be negligible, but I'd rather remove functions of unknown complexity.

Taken together, get_gaussian_kernel_1d now generates correct kernels for all $\sigma\ge 0$.

Since I only changed the behavior for edge cases (very small sigma), the behavior of our Gaussian blur remains unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant