everyone,
I am trying to convert a height colormap image (RGBA) into a 2D matrix so we can do something about it. I thought this would be a well-developed procedure but I cannot find any existing function to do this.
Here is the same of my colormap, red means a higher area (peak), blue means the lower area (valley), it ranges from (blue) -10 to (red) 10 um
The image is a surface topography of a milled surface. We want to get the roughness Ra by taking the average (arithmetical mean height) of the matrix. We also have the measurement of the Ra so we can compare to see if our calculations are correct.
I tried to convert the rgb to hsv and wish to find some relation between the height and the hue value (I do convert hue value to -10 to 10). But it seems the calculated Ra is way off the measurement. Also, I have already cut off the edges when I calculate the image roughness.
May I ask if anyone has an idea about this issue? Python or matlab preferred but other platforms/languages are fine too.
The RGBa image is not marked relatively, and here is the color bar for the image. Color scale