If the color bar posted by OP really belongs to the image then the following should provide quite a good approximation. First, I extract the color bar scale
and the actual image actualimage
from the plot. By hand. This can certainly be automated somehow. Next, I use Nearest
to build up a lookup table nf
for color values. (This will result is strange results for pixels in the image that have a color that does not appear in the color bar. But this should not happen anyway.) Finally, I apply the NearestFunction
nf
to each pixel in order to find the temperature value whose color value on the color bar is closest to the pixel.
img = Import["https://i.stack.imgur.com/US42T.png"];
scale = Mean /@ ImageData[img][[27 ;; -26, -90 ;; -60]];
actualimage = ImageData[img][[;; , 1 ;; -112]];
nf = Nearest[scale -> Reverse@Subdivide[-7.2, 11.0, Length[scale] - 1]];
T = ArrayReshape[nf[Flatten[actualimage, 1], 1],Dimensions[actualimage][[1 ;; 2]]];
Here is a grayscale version of the resulting temperature array T
:
Image[Rescale@T]
