How can I find all zeros in a 2d matrix and change those values by interpolating with the closest available values ?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Akzeptierte Antwort
Image Analyst
am 8 Jun. 2017
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 Kommentare
Weitere Antworten (1)
Walter Roberson
am 7 Jun. 2017
[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 Kommentare
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!