I'm trying to reconstruct a density plot from a raster image. The idea is to assign the uppermost value of the scale (an arbitrary linear scale) to the "most red" points of the image, and the lowest value to the "most blue" part of the image.
What I have tried so far is to convert the image to gray scale, then get the image's pixel values with ImageData
and multiply them by an arbitrary factor to get the [0,100] scale.
im = Import["https://imgur.com/Cm549qE.png"]
imG = ColorConvert[im, "Grayscale"];
imgData = 100 ImageData[imG];
ListDensityPlot[Reverse[imgData], ColorFunction -> "TemperatureMap",
PlotLegends -> Automatic]
This approach doesn't work because both the most red and the most blue parts of the image are assigned roughly the same value in the resulting density plot.
This question is perhaps related to this post but I haven't been able to adapt the code to my problem. Could someone suggest another solution? Thank you.