-
Notifications
You must be signed in to change notification settings - Fork 50
2D Tophat (Disk) Kernel #165
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
base: master
Are you sure you want to change the base?
Conversation
|
Bumping this |
|
I think this can be tested in a |
|
This implementation is based off the skimage.draw.disk implementation which is used in the python library which inspired this PR. |
jw3126
left a comment
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.
Thanks for the PR, see my above remarks and some tests would be good.
|
|
||
| """ | ||
| tophat(r) -> k | ||
| tophat(r, ls) -> k |
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.
Rename ls to size and explain it?
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.
Also some doctests would be nice.
| kern[idx] = amplitude | ||
| end | ||
| end | ||
| return kern ./ sum(kern) # renormalize |
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.
Why do you compute amplitude above, if you normalize it away here anyway?
This adds a 2D "tophat" kernel. This is geometrically just a disk. I'm not an images guy, per se, so if there is a more apt name than
tophat, please inform me!The two functions added to
Kernelaretophat(r)- default size is2rrounded up to the nearest odd integer. The cells whose distance from the center is less than or equal torwill be constant and all other will be zero. The constant will be such that the sum is 1.tophat(r, ls)- the same as above, but allos user-input sizels. This will handle even and odd based shapes, and even mixes of both (eg(6, 7). Again, the pixels whose distance from the center is less than or equal torwill be a normalized constant.I've added a docstring and imported correctly under
ImageFiltering.jl. I've added it to theKernelmodule docstring, too. Unfortunately I'm not having a great time parsing the test suite, so I don't have any tests. Please let me know where I can test this.