Example for a 2D Median Filter #12
RoyiAvital
started this conversation in
General
Replies: 1 comment 1 reply
-
I think you meant For some kernels like median there are more clever algorithms which scale better with window size such as the Herk-Gil-Werman algorithm. Keep in mind that The MR implementing median for @inline function mymedian(w::StaticKernels.Window)
v = SVector(Tuple(w))
v = @inline sort(v; alg = StaticArrays.BitonicSort)
isodd(length(v)) ? v[end ÷ 2 + 1] : ((v[end ÷ 2] + v[end ÷ 2 + 1]) / 2)
end
k = Kernel{(-2:2,-2:2)}(mymedian) which should be slightly faster than what you did. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I find
StaticKernels.jl
to be a jewel for low level image processing in Julia.It is odd, as Julia is very good choice for image processing yet the landscape of packages is rather small.
Unless you go the
JuliaImages.jl
path, which I don't like due to the choice Arrays of Struct as the underlying type and large dependency.I prefer working with
Matrix{T}
andArray{T, 3}
for images.This is how I implemented Median Filter with
StaticKernels.jl
:The
Tuple(w)
is required as in #8 (Iterating the window).There are optimized algorithms for 2D Median, yet I couldn't find implementation for simple arrays in Julia.
Beta Was this translation helpful? Give feedback.
All reactions