How can I select the 4-neighbours of a pixel in matlab
?
Thanks.
If the the image is img
and the current pixel indices are i
and j
, then the four neighbors will be:
img(i-1,j);
img(i+1,j);
img(i,j-1);
img(i,j+1);
来源:https://stackoverflow.com/questions/14771631/selecting-the-4-neighbours-of-a-pixel