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.
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.
Rename ls to size and explain it?
There was a problem hiding this comment.
Also some doctests would be nice.
| kern[idx] = amplitude | ||
| end | ||
| end | ||
| return kern ./ sum(kern) # renormalize |
There was a problem hiding this comment.
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.