you have to create a function:

function filter_pixel(x,y,n)

if x>1 AND y>1 and x<n-1 and y<n-1 then

filter_pixel=(x-1,y+1)+(x,y+1)+(x+1,y+1)+(x+1,y)+(x,y)+(x+1,y-1)+(x,y-1)+(x-1,y-1)+(x-1,y)

else

all the border' case

else

end if

end function

function filter_pixel(x,y,n)

if x>1 AND y>1 and x<n-1 and y<n-1 then

filter_pixel=(x-1,y+1)+(x,

else

all the border' case

else

end if

end function