Convert imagesc back to matrix.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a figure generated by calling imagesc on a 1000x1000 matrix. I have the figure saved, but have lost the actual data used to generate it. Is there a way for me to recover the original matrix from this figure, without having to re-run the script used to generate the matrix. TIA.
0 commentaires
Réponse acceptée
Rik
le 30 Mar 2018
Short answer: No.
Medium answer: Maybe, but with severely limited resolution in terms of pixels and data.
Long answer: That would depend on your needs. If the original resolution and precision is not an issue, you can crop the image part and use the colormap to convert the image back to indices (see rgb2ind). There is probably a much lower resolution in your image than the original data, and you are limited to the resolution of the colormap imagesc used and the precision of the file format it was saved to.
4 commentaires
Walter Roberson
le 30 Mar 2018
Sure, with the .fig it is easy.
imh = findobj(groot, 'type', 'image');
X = imh.XData;
Y = imh.YData;
ColorData = imh.CData;
The X and Y returned are probably going to be two-element scalars that give the locations of the centers of the lower-left and upper-right pixels.
The ColorData might perhaps be in RGB, but probably instead will be a 2D array of original unscaled data values -- the data you had asked to plot.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!