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
Gaussian Blur give images a black border on left and right side #7
Comments
Oops just saw that there is another issue about that... However, is there a way to have edge pixels averaged with transparent ones. instead of black ones? |
Yeah on the edges you end up with the average calculation being low because of the "missing" pixels off each side. I get around this in one of my apps by cropping and slightly resizing the picture, it's been a while since I looked at this code in depth but I'll open it up and have a think about whether that could be done, might make for better results! |
It should be optional for the core convolution engine, as there's no "right" answer, for example:
... those are the usual strategies off the top of my head. |
Sorry I've been so slow getting back to this, based on the way the Accelerate.Framework works I'm thinking the best option would be to duplicate the edge pixels prior to the convolution call then crop the resulting image back down to the original size. I think anything else would result in extra vDSP calls (and associated data-type) shuffling which is a bit cumbersome, compilcated (and slow!) I haven't been active on this in quite a while but might have cause to look into it again in the next few weeks. TBC... |
This stills actual problem... |
This is still an actual problem |
Sorry this library is essentially abandoned at this point and I wouldn't recommend using it in new projects. Apple's Core Image library provides similar functionality and be my choice if I were to look into this in 2023. If for some reason you're stuck with this library it's worth noting (as @jasonm23 does above) that there is no one true correct solution to this problem. The algorithm combines each pixel with weighted values from it's neighbours therefore at the edges (where some neighbours are missing) it's simply not possible to calculate the correct value due to missing inputs. Some workarounds you might want to consider are:
|
When applying a gaussian blurr to images, the returned image has two black bands on each side.
This must have something to do with difficulty to apply the filter at the edge of the image but I don't really know how to deal with it...
Any idea?
The text was updated successfully, but these errors were encountered: