How can i achieve a colormapping effect from a pimage rgb (or even i could first convert to grayscale) to a range near the spectral like below? - based on brightness on grayscale. or based on blue and red brightness on rgb.
I took out the ir filter from an old digital camera, and i placed a blue filter on the lens, so i achieved something like near infrared filter. I now want to colorize it in the range shown bellow.
Paint red the most brighter areas, following yellowish, green, blueish… from brighter to darker accordingly, but also achieve that gradient effect also?
The “thermal” images were created after i uploaded my pics to Infragram | by Public Lab - Home converter. the tinted upper right is the actual pic taken after i modified the cam, notice that actually it has brighter colors in vegetation, and areas that actually emit more IR light.
I was planning in using the modified cam to track an ir led that will act as a pen to a diy smartboard, (works fantastic! just like a wiimote controller no interferance from actual bulbs) but i also thought to use it in this senario also. I think it actually is near the output of an ir/thermal camera)
the way i could think but i suppose it is not so good is…
PImage img;
void settings(){
img = loadImage("pics.jpg");
size(img.width,img.height);
}
void setup(){
img.filter(GRAY);
img.loadPixels();
for (int i=0; i<img.pixels.length; i++){
if (brightness(img.pixels[i])>=125){
float x = map(brightness(img.pixels[i]),125,255,color(255,255,0),color(255,0,0));
img.pixels[i] = int(x);
} else if (brightness(img.pixels[i])>=90){
float x = map(brightness(img.pixels[i]),90,125,color(0,150,0),color(0,255,0));
img.pixels[i] = int(x);
} else {
float x = map(brightness(img.pixels[i]),0,90,color(0,0,255),color(0,210,255));
img.pixels[i] = int(x);
}
//temp = map(brightness(temp),125,255
}
img.updatePixels();
image(img,0,0);
}
void draw(){
}
void mouseDragged(){
println(brightness(get(mouseX,mouseY)));
}
but i get something like this
i suppose i could blur it a bit, but can anyone suppose a better way;