Fixed bounding error in the median filter application

This commit is contained in:
Pixelguy14
2025-02-10 18:41:26 -06:00
parent 63c7428214
commit 2b6ec4937f
2 changed files with 9 additions and 24 deletions
+5 -9
View File
@@ -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