Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized box blur implementation #1974

Merged
merged 1 commit into from
Jul 23, 2023

Conversation

RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented Jul 23, 2023

A box blur is a separable filter, so I used OpenCV's sepFilter2D to implement box blur. However, I noticed that the DFT implementation of filter2D eventually catches up to sepFilter2D and ends up being faster for large radii. So I only use sepFilter2D for radii below 70. That's the point of which both are about equal performance-wise.

The speed-up is especially noticeable for small radii. E.g. a radius of 10 on a 2k RGB image takes around 0.08 sec with sepFilter2D and around 0.27 sec with filter2D.

Also, just to clarify: this is a pure optimization. The outputs of filter2D and sepFilter2D are the same.

@joeyballentine joeyballentine merged commit 4e183d8 into chaiNNer-org:main Jul 23, 2023
10 checks passed
@RunDevelopment RunDevelopment deleted the box-blur-opt branch July 23, 2023 20:17
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.

2 participants