How can I find all zeros in a 2d matrix and change those values by interpolating with the closest available values ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MSP
el 7 de Jun. de 2017
Respondida: Image Analyst
el 8 de Jun. de 2017
For example, A=
0 comentarios
Respuesta aceptada
Image Analyst
el 8 de Jun. de 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 comentarios
Más respuestas (1)
Walter Roberson
el 7 de Jun. de 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 comentarios
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!