-
Notifications
You must be signed in to change notification settings - Fork 150
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
median_filter is two orders of magnitude slower than opencv::imgproc::median_blur. #530
Comments
The first thing to check is whether opencv is using the GPU in this case or not. |
OpenCV may well be doing something smarter, but one difference here is that you're using a 7x7 filter for OpenCV and a 15x15 filter for imageproc. OpenCV takes a width parameter that it requires to be odd, whereas imageproc takes a radius parameter and uses a filter of size 2*radius + 1 to ensure it's always odd. This is possibly a confusing API! |
Having reminded myself of what the code does, the imageproc implementation is linear in kernel width so your accidental difference in parameters shouldn't account for much of the difference between the two libraries! Quick empirical sanity check for this:
That's still slower than your OpenCV run time, but far faster than your imageproc run time. I suspect you might be running your code in debug mode and so comparing a debug build of imageproc against a release build of OpenCV. From a quick glance at the source code for OpenCV's implementation, it looks to be doing something roughly similar to what we do in imageproc, but with SIMD acceleration. I wouldn't be too surprised by a 5-10x difference in run time, but 200x looks wrong. @wangm23456 can you check if you're running imageproc in debug or release mode. |
The text was updated successfully, but these errors were encountered: