How can I interpolation values within a 3D matrix by ignoring zeros?
Afficher commentaires plus anciens
I have a 3-D matrix, many values of which are zero but some of which have non-zero values in them.
I'd like to fill in the zeros by 'interpolating' or filling in based on the non-zero values. I don't want the zeros to go into the calculation of the interpolation, only the non-zero values, and these values should replace the non-zero values.
Réponses (2)
Kelly Kearney
le 7 Nov 2013
Modifié(e) : Kelly Kearney
le 7 Nov 2013
x(x == 0) = NaN;
newx = inpaint_nans3(x);
Image Analyst
le 7 Nov 2013
If you have the Image Processing Toolbox, use roifill(). Create your binaryImage like this:
binaryImage = image3D == 0;
Then fill
filledImage = roifill(image3d, binaryImage);
2 commentaires
Ajay
le 7 Nov 2013
Image Analyst
le 7 Nov 2013
The documentation didn't say that it was limited to 3D images, but maybe it is. In that case there's no built in method and you'll have to write your own.
Catégories
En savoir plus sur Interpolation dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!