144 views (last 30 days)

Show older comments

shikha mangal
on 22 Apr 2016

Image Analyst
on 5 Sep 2014

neighbors(1) = img(r-1,c-1); % Upper left. r = row, c = column.

neighbors(2) = img(r-1,c); % Upper middle. r = row, c = column.

neighbors(3) = img(r-1,c+1); % Upper right. r = row, c = column.

neighbors(4) = img(r,c-1); % left. r = row, c = column.

neighbors(5) = img(r,c+1); % right. r = row, c = column.

neighbors(6) = img(r+1,c+1); % Lowerleft. r = row, c = column.

neighbors(7) = img(r+1,c); % lower middle. r = row, c = column.

neighbors(8) = img(r+1,c-1); % Lower left. r = row, c = column.

Order them in whatever order is convenient for you.

Yohanes Setiawan
on 6 Feb 2020

Hello

Is there any way to automate those neighbors(1) to neighbors(8)?

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!