Created
July 9, 2017 17:34
-
-
Save tejus-gupta/e391cbdd7dea1320be64c38ad16285f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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