Created
April 23, 2013 12:24
-
-
Save uugan/5443142 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
/* Median filter 5x5 6<sup>th</sup> kernel */ | |
float MedianFile5x5(unsigned char* inbuf, unsigned char* outbuf, int height, int width){ | |
unsigned char wind[25]; | |
int start = GetTickCount(); | |
int cnt=0; | |
for(int i=2; i< height - 2; i++) | |
for(int j=2; j< width - 2; j++){ | |
cnt=0; | |
for(int p=-2;p<=2;p++){ | |
for(int k=-2;k<=2;k++){ | |
wind[cnt++]=inbuf[(i+p)*width+j+k]; | |
} | |
} | |
sort(wind,wind+25); | |
outbuf[i*width+j] = wind[12]; /*get central value */ | |
} | |
return (float)(GetTickCount()-start); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment