Convert imagesc back to matrix.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Liam McRoe
am 30 Mär. 2018
Kommentiert: Liam McRoe
am 4 Apr. 2018
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 Kommentare
Akzeptierte Antwort
Rik
am 30 Mär. 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 Kommentare
Walter Roberson
am 30 Mär. 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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!