MATLAB: Strange 3×3 Lowpass filter

blurringfilterimage processingImage Processing Toolbox

I need to perform an article about hdr imagining and i see a formula that smooth the pixel.But it is different formulla. Can someone help me to code it on matlab
but i think first iteration will be problem. when i and j start with 1 and k is -1 first iteration will be ymax(0,0) but there is no such a thing like that in MATLAB.I think we should add +1 near i+k and j+l.
Thank you

Best Answer

It looks like a pretty straightforward 3x3 averaging filter. The catch is you have to start with (i=2,j=2) so i+(-1) will be 1 and same for j. You can do this pixel by pixel, or you can do it much faster with imfilter:
ylpf = imfilter(ymax,fspecial('average',[3 3]));
No loops necessary.