hi, i read up some articles about mean filter and its use-age. however im connfused about it when it comes to coding it. can someone explain to me in mathematical term on how its done? this is what i implemented so far, help from here one will be great:

CLEO_MedivisionView::OnNoiseremovalMedianfilter() {

unsigned int meanarray[262144];  
int i;  

for (i=0; i<262144; i++) {
for (i=2; i<262144-2; i++) {
meanarray[i - 2]= (image[i - 2] +image[i - 1] +image[i] +image[i + 1] +image[i + 2]) / 5;
thing to note is when i debug at the breakpoint, i get an error saying that the stack is overflow or something like that.