I know that there is a function called nlfilter
in matlab. What I'm trying to find is the 4-neighbours
of a pixel. Does that means a 2x2
window? Can we do that using nlfilter
?
Thanks.
I know that there is a function called nlfilter
in matlab. What I'm trying to find is the 4-neighbours
of a pixel. Does that means a 2x2
window? Can we do that using nlfilter
?
Thanks.
I think you might find this easier to comprehend if you think of it in terms of blocks rather than in terms of neighbors. So a 2x2 neighbor is actually just a 2x2 block.
If you are talking about a center pixel relative to a north, south, east, west pixel, then you would want to use a 3x3 block. Unfortunately, that block would also include northeast, northwest, southeast, southwest neighbors.
Here is an example of sliding neighborhood operations in Matlab using nlfilter.