Open mileslucas opened 4 years ago
Bumping this
I think this can be tested in a @testset "tophat"
in test/2d.jl
. Is this tophat
function coming from matlab or somehow standard? There are a lot of variantions on how to turn a circle into pixels. E.g. constant value strictly inside, value proportional to circle area intersected with pixel etc.
This implementation is based off the skimage.draw.disk implementation which is used in the python library which inspired this PR.
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
Kernel
aretophat(r)
- default size is2r
rounded up to the nearest odd integer. The cells whose distance from the center is less than or equal tor
will 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 tor
will be a normalized constant.I've added a docstring and imported correctly under
ImageFiltering.jl
. I've added it to theKernel
module 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.