Custom false color palette

I'm trying to make a false color / pseudo color image that matches the
color palette from a non-lighting program. It would work great with
four nested IF statements, but falsecolor -r/g/b doesn't seem to want
to take them. Has anybody come up with a workaround for this or am I
better off editing the falsecolor script?

Perhaps there is a way to use higher order functions?

Here's an image of the scale and a close numerical pseudocolor
traversal: http://tinyurl.com/4e2x7m

This would be the if statement for the falsecolor -r argument:
if(v-5/7,1,if(v-4/7,7v-4,if(v-2/7,0,if(v-1/7,2-7v,7v))))

--Dave

Hi Dave,

Maybe not direct answer to your question. In RadDisplay tool
Accueil you can define
custom palette for radiance images.

Palette is not defined with the functions (we didn't implement that
feature yet), but you can select individual palette colors or define
start and end color and program will generate the palette. You can
also define palette maximum and minimum value, which can also be very
helpful in some cases.

If you must follow the formula then it is better to work with
falsecolor program.

Marija

···

On Thu, Sep 18, 2008 at 12:10 AM, David Smith <[email protected]> wrote:

I'm trying to make a false color / pseudo color image that matches the
color palette from a non-lighting program. It would work great with
four nested IF statements, but falsecolor -r/g/b doesn't seem to want
to take them. Has anybody come up with a workaround for this or am I
better off editing the falsecolor script?

Perhaps there is a way to use higher order functions?

Here's an image of the scale and a close numerical pseudocolor
traversal: ImageShack - Best place for all of your image hosting and image sharing needs

This would be the if statement for the falsecolor -r argument:
if(v-5/7,1,if(v-4/7,7v-4,if(v-2/7,0,if(v-1/7,2-7v,7v))))

--Dave

Hi Dave,

Your formula should be fine, you just need to remember there's no implied multiplication. Instead of:

  if(v-5/7,1,if(v-4/7,7v-4,if(v-2/7,0,if(v-1/7,2-7v,7v))))

use:

  falsecolor -r "if(v-5/7,1,if(v-4/7,7*v-4,if(v-2/7,0,if(v-1/7,2-7*v,7*v))))" ...

Hope this helps.
-Greg

···

From: "David Smith" <[email protected]>
Date: September 17, 2008 3:10:32 PM PDT

I'm trying to make a false color / pseudo color image that matches the
color palette from a non-lighting program. It would work great with
four nested IF statements, but falsecolor -r/g/b doesn't seem to want
to take them. Has anybody come up with a workaround for this or am I
better off editing the falsecolor script?

Perhaps there is a way to use higher order functions?

Here's an image of the scale and a close numerical pseudocolor
traversal: ImageShack - Best place for all of your image hosting and image sharing needs

This would be the if statement for the falsecolor -r argument:
if(v-5/7,1,if(v-4/7,7v-4,if(v-2/7,0,if(v-1/7,2-7v,7v))))

--Dave

Aha, that was it, Greg. Thank you very much, it was a long day.

I still prefer the thermal- and very-technical-looking 3.8+ scale, but
for anybody interested, here are the falsecolor switches for the scale
I was talking about starting at black:

-r 'if(v-5/7,1,if(v-4/7,7*v-4,if(v-2/7,0,if(v-1/7,2-7*v,7*v))))'
-g 'if(v-6/7,7*v-6,if(v-5/7,6-7*v,if(v-3/7,1,if(v-2/7,7*v-2,0))))'
-b 'if(v-6/7,7*v-6,if(v-4/7,0,if(v-3/7,4-7*v,if(v-1/7,1,7*v))))'

...and starting at a 1/3 gray:

-r 'if(v-5/7,1,if(v-4/7,7*v-4,if(v-2/7,0,if(v-1/7,2-7*v,7*v+1/3))))'
-g 'if(v-6/7,7*v-6,if(v-5/7,6-7*v,if(v-3/7,1,if(v-2/7,7*v-2,if(v-1/7,0,1/3-7*v*1/3)))))'
-b 'if(v-6/7,7*v-6,if(v-4/7,0,if(v-3/7,4-7*v,if(v-1/7,1,7*v+1/3))))'

(Watch out for the line breaks.)

--Dave

Whoops, the initial slope was incorrect for the red and blue on the
gray version:

-r 'if(v-5/7,1,if(v-4/7,7*v-4,if(v-2/7,0,if(v-1/7,2-7*v,7*v*2/3+1/3))))'
-g 'if(v-6/7,7*v-6,if(v-5/7,6-7*v,if(v-3/7,1,if(v-2/7,7*v-2,if(v-1/7,0,1/3-7*v*1/3)))))'
-b 'if(v-6/7,7*v-6,if(v-4/7,0,if(v-3/7,4-7*v,if(v-1/7,1,7*v*2/3+1/3))))'

That should do it. Mea culpa.

--Dave

Hello Dave,

I'm not sure this will help you, but in our "posterize" script which may
be downloaded from here:
http://www.bakharev.org/index.php?option=com_content&task=view&id=33&lang=english

we used this CAL-code:

···

=================================
    min : $min ;
    max : $max ;
    step : $step ;
    scale : $max-$min ;

    clip(x) : if(x-1,1,if(x,x,0));

    render(x) = floor((x-min)/step)*step/scale;
    {render(x) = (x-min)/scale;}

    interp_arr10(x, arr) = ( (x-floor(x)) *
arr(ceil(x)+1)-arr(floor(x)+1)) / 1 ) + arr(floor(x)+1);
    interp_arr(x, arr) = interp_arr10(x*10, arr);

    def_red(x) = interp_arr(x, def_red_arr);
    def_grn(x) = interp_arr(x, def_grn_arr);
    def_blu(x) = interp_arr(x, def_blu_arr);

    def_red_arr(i) : select(i,
.03,.17,.31,.45,.57,.67,.76,.84,.90,.97,.99 );
    def_grn_arr(i) : select(i,
.10,.21,.32,.43,.53,.60,.69,.78,.87,.96,.99 );
    def_blu_arr(i) : select(i,
.27,.34,.41,.47,.53,.58,.64,.74,.85,.95,.96 );

    in = 1;

    ro = if(in, def_red(clip(render(v))), rorig);
    go = if(in, def_grn(clip(render(v))), gorig);
    bo = if(in, def_blu(clip(render(v))), borig);

Where you can implement your own palette by changing these lines:
...select(i, .03,.17,.31,.45,.57,.67,.76,.84,.90,.97,.99 );
...select(i, .10,.21,.32,.43,.53,.60,.69,.78,.87,.96,.99 );
...select(i, .27,.34,.41,.47,.53,.58,.64,.74,.85,.95,.96 );

Best Regards,
Ilya A. Zimnovich

David Smith wrote:

I'm trying to make a false color / pseudo color image that matches the
color palette from a non-lighting program. It would work great with
four nested IF statements, but falsecolor -r/g/b doesn't seem to want
to take them. Has anybody come up with a workaround for this or am I
better off editing the falsecolor script?

Perhaps there is a way to use higher order functions?

Here's an image of the scale and a close numerical pseudocolor
traversal: ImageShack - Best place for all of your image hosting and image sharing needs

This would be the if statement for the falsecolor -r argument:
if(v-5/7,1,if(v-4/7,7v-4,if(v-2/7,0,if(v-1/7,2-7v,7v))))

--Dave

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general