HSV values from rtrace

Hi everyone,

I've been using Radiance in some research, and for one experiment I would
like to look at things from a colour perspective. The normal way I would
go about would be converting values to HSV, but because of the values that
return from rtrace, I don't know how I would go about doing this. Is such
a thing possible or is there another way to look at the colour of the light?

Thanks,
Kelly Moylan

Hi Kelly,

There are many, many ways to represent color, unfortunately.

There is no reason you could not apply the HSV formulas (say from <http://en.wikipedia.org/wiki/HSL_and_HSV>) to RGB values out of Radiance. To get the actual color values from an image, you can use the "pvalue" program to convert to ASCII format. From there, you can use the "rcalc" program to convert to other coordinates, e.g.:

  pvalue -h -H -d render.hdr \
    > rcalc -e 'iR=$1;iG=$2;iB=$3' -e 'cmax=if(iR-iG,if(iR-iB,1,3),if(iG-iB,2,3))' -e '$1=cmax'

For each pixel, the above command would tell you which channel was largest, 1 (red), 2 (green), or 3 (blue). The complete formula to get to HSV is more complicated, but hopefully this will get you started.

There are already functions provided to get from XYZ color space to CIE Lab and Luv spaces. However, these spaces require you to define a maximum "white" value, which you may or may not know. If the maximum white is "100", you could use the following to compute Lab coordinates for each pixel:

  ra_xyze render.hdr \
    > pvalue -h -H -d \
    > rcalc -f cielab.cal -e 'Xw=100;Yw=100;Zw=100' -e '$1=Ls($2);$2=as($1,$2,$3);$3=bs($1,$2,$3)'

The first command (ra_xyze) converts from an RGB to an XYZ picture, which you could also do with rcalc, but this way is probably faster and easier to show.

Best,
-Greg

···

From: Kelly Moylan <[email protected]>
Subject: [Radiance-general] HSV values from rtrace
Date: July 28, 2014 2:56:18 PM PDT

Hi everyone,

I've been using Radiance in some research, and for one experiment I would like to look at things from a colour perspective. The normal way I would go about would be converting values to HSV, but because of the values that return from rtrace, I don't know how I would go about doing this. Is such a thing possible or is there another way to look at the colour of the light?

Thanks,
Kelly Moylan