I've an 8-bit grayscale image representing intensities. I would like to display it with color according the intensity value (to be clear,something like this http://www.matthiaspospiech.de/files/matlab/plot/pcolor/pcolor-example-simple.png).
I tried with an HSV scale (with H in (0->85) or (85->140) or (140->255) and then go back to RGB but it seems not to work. Does any have an idea ? Here is my code: (it runs in loops on
img is the grayscale image,
grey = img[j*w+i]; H = (grey * 360.0) / 255 ; X = 1-((int)abs((int)(h/60.0) % 2) - 1); if(BETWEEN(H,0,60) || BETWEEN(H,300,360)) r = 1.0; else if(BETWEEN(H,60,120) || BETWEEN(H,240,300)) r = X; else r = 0; if(BETWEEN(H,60,180)) g = 1.0; else if(H >= 240) g = 0; else g = X; if(BETWEEN(H,180,300)) b = 1.0; else if(H < 120) b = 0; else b = X; R = (int)(r*255.0); G = (int)(g*255.0); B = (int)(b*255.0);
(the final goal is to use it in a Java program with OpenImaj so if someone knows something about it, it's fine too :) )