Displaying 1 result from an estimated 1 matches for "outrow".
Did you mean:
outgrow
2011 Mar 27
6
Asking Favor For the Script of Median Filter
...ilter with window size 3X# to remove salt and pepper noise in my matric.
Here are the script I attend to writing.The script and output shown as
below:
> MedFilter<-function(mat,sz)
+ {out<-matrix(0,nrow(mat),ncol(mat))
+ for(p in 1:(nrow(mat)-(sz-1)))
+ {for(q in 1:(ncol(mat)-(sz-1)))
+ {outrow<-median(as.vector(mat[p:(p+(sz-1)),q:(q+(sz-1))]))
+ out[(p+p+(sz-1))/2,(q+q+(sz-1))/2]<-outrow}}
+ out}
> MedFilter(x,3)
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 0 0 0
[2,] 0 8 12 14 0
[3,] 0 12 14 19 0
[4,] 0 18 15 20 0
[5,] 0 0...