How to add the neighboring pixel values

1 回表示 (過去 30 日間)
Sharen H
Sharen H 2015 年 6 月 30 日
回答済み: Walter Roberson 2015 年 6 月 30 日
I have a matrix - if 0 occurs then i have to add the 8 neighboring pixels and replace the 0 value . is there any built in function for this ..

採用された回答

Walter Roberson
Walter Roberson 2015 年 6 月 30 日
filt2() with [1 1 1;1 0 1; 1 1 1] to get the sums everywhere. Then in the places that are 0 in the original, replace with the sum at the corresponding location. Use logical indexing.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by