Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function median_filter{T, N}(img::AbstractArray{T, N}, window::NTuple{N, Int})
all(isodd(w) for w in window) || error("entries in window must be odd, got $window")
R = CartesianRange(size(img))
half_window = map(w->w>>1, window)
Rinner = CartesianRange(first(R)+CartesianIndex(half_window), last(R)-CartesianIndex(half_window))
for i in Rinner
if i[1] = first(Rinner)[1]
#reinitialize histogram
end
#update elements and calculate new median
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment