0
votes

I have a .png image that has been created from some grayscale numbers using Matlab's imagesc tool using the standard color map. For some reason, I am unable to recover the raw data. Is there a way of recovering the raw data from the image? I tried rgb2gray which more or less worked, but if I replug the new image into imagesc, it gives me a slightly different result. Also, the pixel with the most intensity differs in both images.

So, to clarify: I would love to know, how Matlab applies the rgb colormap to the grayscale values, when using the standard colormap.

This is the image we are talking about: http://imgur.com/qFsGrWw.png

Thank you!

1
If your data is double then this is not possible since a PNG will discard your 64-bit floating point data in favor of an 8-bit integer datatype. Also rgb2gray doesn't inversely map a colormap, but rather just converts it to grayscale. If you tell us what you're actually trying to accomplish maybe we can provide more help - Suever
My data is uint8. And I am trying to "undo" the imagesc with the standard color map (I know the intensity of the brightest pixel, so therefore I could convert everything back), because otherwise, I have no more acces to the raw data. So basically I need the brightness of every pixel of the image I linked in the question. - FMu
If you want to keep your data in tact, save it in a .mat file rather than trying to take a screenshot and save it as an RGB png. - Suever
I know, but this is just not possible, since I didn't take the image but someone else did. - FMu

1 Answers

1
votes

No, you will not get the right data if you are using the standard colormap, or jet.

Generally, its a very bad thing to try to reverse engineer plots, as they will never contain the entirety of the information. This is true in general, but even more if you use colormaps that are do not change accordingly with the data. The amount of blue in jet is massively bigger in range than the amount of orange, or another color. The color changes are non-linear with the data changes, and this will make you miss a lot of resolution. You may know what value orange corresponds to, but blue will be a very wide range of possible values.

In short:

  1. Triying to get data from representation of data (i.e. plots) is a terrible idea

  2. jet is a terrible idea