-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Lens Blur node #1516
Lens Blur node #1516
Conversation
Add lens blur node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR @harisreedhar!
I looked through your code and have a few suggestions.
Also, please format the new code with black.
@joeyballentine Does opencv or numpy include scipy? |
@RunDevelopment I don't think so, so that means we would need to add that as another dependency. It's actually required by facexlib so anyone who has the pytorch deps installed already has it. |
def conv2d(a, f):
s = f.shape + tuple(np.subtract(a.shape, f.shape) + 1)
strd = np.lib.stride_tricks.as_strided
subM = strd(a, shape = s, strides = a.strides * 2)
return np.einsum('ij,ijkl->kl', f, subM) EDIT: Above function produces small square blocks in image. not same as scipy.signal :( |
PR1516 suggestions
Maybe we could use |
Found gimp lens blur filter using cv2.filter2D. It is faster than current implementation |
Use gimp lens blur filter to eliminate scipy dependency
Holy, it's waaay faster. Nice! My little test example dropped from 51s to 4.3s, so it's over 10x faster. |
Add lens blur node
