%Count how many 1's are in each 5×5 window.
kernel = ones(5,5);
% Note: must cast your binary image to dingle or double.
countImage = conv2(single(originalImage), kernel, 'same');
I just want get the 1's on the edge of window which count =4,ignore the middle part how to do it?
example:
1 0 1 0 00 1 0 1 11 0 1 1 00 1 1 1 00 0 0 0 0
Best Answer