I have tried using :
Result = conv2(M, ones(3), 'same')./conv2(ones(3),ones(3), 'same')
But this approach includes the diagonal neighbours, how can i exclude them.
Thanks in advance
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!