Info
この質問は閉じられています。 編集または回答するには再度開いてください。
how to replace a matrix element by the avearage of its surrounding elements
1 回表示 (過去 30 日間)
古いコメントを表示
1 2 3
A= 4 5 6
7 8 9
is a matrix
resultant matrix
11/3 19/5 13/3
B= 23/5 40/8 27/5
17/3 31/5 19/3
0 件のコメント
回答 (1 件)
Henric Rydén
2015 年 6 月 15 日
編集済み: Henric Rydén
2015 年 6 月 15 日
A=[ ...
1 2 3 ; ...
4 5 6 ; ...
7 8 9];
kernel = [ ...
1 1 1; ...
1 0 1 ; ...
1 1 1];
neighbors = imfilter(ones(size(A)),ones(size(A)))-1;
result = imfilter(A,kernel) ./ neighbors;
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!