I know that there has a way to transfer height information to RGB gradient. Is there any way to do it opposite? I found a temperature map and want to create a 3D geometry based on RGB information which means that each different RGB corresponds with different height. Moreover, I want these corresponded height to match the original legend bar very well RGB to height.gh
Any suggestion is appreciated!
I have never had really good results with this, but you must redraw the gradient by hand, generate lots of colours along it, convert those rgb colours to xyz points. Then you can find the closest index of some pixel into your gradient. Finally map this index into your elevation range.
This is a draft, done for fun… double check, everything could be wrong.
I’ve used some c# to build up a mesh from the gradient;
then manually set (from Gh to rhino 3d environment) a line from the center of first gradient cell to last gradient cell;
then subdivided the line by proper count (16) and used evaluate mesh to get color of cell centers colour;
converted that list of colours to points and made a polyline;
This could be a “gradient-3Dpolyline” … (what? )
Created again another mesh from your thermal map and converted each colour to point;
found normalized parameter (closest point) to the polyline and use that value to move mesh vertices in Z.
(with my c# code each mesh have x-1 and y-1 dimensions as each pixel “become” a vertex of the mesh)
RGB to height_maje.gh (20.3 KB)
I’ve searched for your original thermal map, but all i’ve found was a similar one with text over it…
So I had to recover and extract your original image from the image sampler of your gh file
(This was the hardest part … LOL)
(I’ve recycled the c# code from here How to map a set of different geometries to different values on a surface?)