Fixed bounding error in the median filter application
This commit is contained in:
@@ -389,23 +389,19 @@ end
|
||||
# with the close pixels just from the sides to reduce noise.
|
||||
# This one in particular is a midpoint fiter from a 3x3 neighbour area
|
||||
function medianFilterjl(pixMap)
|
||||
width, height = size(pixMap)
|
||||
height, width = size(pixMap)
|
||||
target = zeros(eltype(pixMap), height, width)
|
||||
println("Matrix Dimensions: ", size(pixMap))
|
||||
|
||||
for j in 2:(width-1)
|
||||
for i in 2:(height-1)
|
||||
println("Current Indices: i = $i, j = $j")
|
||||
neighbors = []
|
||||
for dj in max(1, j-1):min(width, j+1)
|
||||
for di in max(1, i-1):min(height, i+1)
|
||||
for dj in max(1, j-1):min(j+1, width)
|
||||
for di in max(1, i-1):min(i+1, height)
|
||||
push!(neighbors, pixMap[di, dj])
|
||||
end
|
||||
end
|
||||
target[i, j] = median(neighbors)
|
||||
end
|
||||
end
|
||||
return target
|
||||
end
|
||||
|
||||
return target
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user