Mathematica
data={{0,4,10,5,3},
{4,4,1,8,5},
{5,1,2,3,8},
{8,6,8,8,10},
{10,3,7,7,8}};
filter= (1/4){{0,1,0},
{1,0,1},
{0,1,0}};
data[[2;;-2,2;;-2]]=ListConvolve[filter,data];
N[%]
|
{{0., 4., 10., 5., 3.},
{4., 2.5, 6., 3.5, 5.},
{5., 4.25, 3.25, 6.5, 8.},
{8., 5., 5.75, 7., 10.},
{10.,3., 7., 7., 8.}}
|