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

[Feature Request] Convolution Filters #9

Open
iamcarbon opened this issue Aug 30, 2017 · 6 comments
Open

[Feature Request] Convolution Filters #9

iamcarbon opened this issue Aug 30, 2017 · 6 comments
Assignees

Comments

@iamcarbon
Copy link
Contributor

iamcarbon commented Aug 30, 2017

It would be handy to support convolution filters (3x3 & 5x5, & 7x7) to support Blur, Sharpening, and Edge Detection Filters.

@saucecontrol
Copy link
Owner

This has been on my list for a while. I guess I'll get busy on it

@JimBobSquarePants
Copy link

I've got a whole bunch of code for that in ImageSharp that you can use to get started with. I'm sure you'll be able to improve on it though.

@saucecontrol
Copy link
Owner

Thanks @JimBobSquarePants! I have the internals pretty well covered but I believe I'll have a look at what you've done and see if I can steal some ideas for the API shape :)

@iamcarbon I'm going to go ahead and expose the existing Gaussian Blur and Unsharp Mask filters I have internally (they'll give better quality than fixed blur/sharpen kernels), but I'm struggling a bit with how something like edge detection might fit in the MagicScaler pipeline. Most of the scenarios I can think of would require forking off a copy of the image to run the edge detection on and then using that to apply other changes back to the original image. Is that what you had in mind also, or am I overcomplicating that?

@iamcarbon
Copy link
Contributor Author

@saucecontrol Yeah, tricky. We have this working in ImageSharp now by rendering to an intermediate pixel buffer. Ideal case is that we can come up with some sort of line scanner matched to the kernel size that avoids allocating an intermediate target -- but will keep thinking on this.

In the meantime, our main use case is covered nicely with a simple Gaussian Blur Filter.

@saucecontrol
Copy link
Owner

All righty, that sounds good. The current Unsharp Mask implementation is probably a good model for most types of masking operations. It uses sliding buffers (of the kernel size) to keep the original and blurred copies of the image lines and uses those to calculate the sharpened result to the output buffer. So the mechanics are already there... I'm just not sure how I'd expose something like that in the public API. I'll try and come up with another similar use case that I can plan around. Or if you have something specific already in mind, let me know, and I can try to build that out as a test case.

@JimBobSquarePants
Copy link

I'd also like to know exactly what you are trying to achieve here if that's alright so we can achieve the same.

@saucecontrol saucecontrol changed the title Convolution Filters [Feature Request] Convolution Filters Mar 21, 2018
@saucecontrol saucecontrol self-assigned this Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants