How can I find all zeros in a 2d matrix and change those values by interpolating with the closest available values ?
5 ビュー (過去 30 日間)
古いコメントを表示
For example, A=
0 件のコメント
採用された回答
Image Analyst
2017 年 6 月 8 日
You could use regionfill(), if you have the Image Processing Toolbox, to do it in a single line of code:
outputArray = regionfill(inputArray, inputArray == 0);
0 件のコメント
その他の回答 (1 件)
Walter Roberson
2017 年 6 月 7 日
[gr, gc, gv] = find(A);
F = scatteredInterpolant(gr, gc, gv);
[br, bc] = find(~A);
replacements = F(br, bc);
A( sub2ind(size(A), br, bc) ) = replacements;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!