I need to get pixel neighbors in order to get a sequence of boundary points , so my plan is to :-
How can i get pixel neighbors in MATLAB ?
You could always define a displacement vector
d = [ 1 0; -1 0; 1 1; 0 1; -1 1; 1 -1; 0 -1; -1 -1];
Then the neighbors of location loc =[i j] are
neighbors = d+repmat(loc,[8 1]);
Hope is useful to you...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With