Insert text in Radiance images at specific location (x y z)

Hello everyone,

I wish to show illuminance values at specific locations at world
coordinates (x y z) in an image. I mean, to show the illuminance values (in
an orthographic image of a plan created by a camera with parallel lens) at
the real position of the illuminance sensors (Rtrace/Rsensor).

The only way I could find is to use Psign to produce text's image, and then
position the produced text in the plan image by using Pcompos. Something
like this: psign 100 Lux | pcompos inp.hdr 0 0 +t .5 - 200 200 >
out.hdr. However,
Pcompos takes input of the location of a pixel and places the text there.
This is not what I intend to achieve.

Are there other ways to do this? Thank you in anticipation.

Best regards,
Vaibhav Jain
www.vaibhavjain.co

Hi Vaibhav,

This is probably in the archives, somewhere, but I wouldn't want the task of trying to find it myself, so I won't insist you look, either.

If you have a list of (x,y) pixel coordinates (where x is horizontal position from the left and y is vertical position from the bottom), you can use vwrays to generate rays and compute illuminance values to composite into your image. You can generate such a list using the 't' command in ximage:

  ximage -tp myrendering.hdr > positions.txt

Just move the cursor over each place you want to compute illuminance and type 't'. Don't expect a beep or anything, and don't hold down the 't' or you'll get a whole list of identical values when it repeats. (If you prefer, you can click the middle mouse button instead of typing 't'.)

The list of positions can then be used in the following manner to generate illuminance values and output them via psign and pcompos:

  $ echo pcompos myrendering.hdr 0 0 \\ > pcom.sh
  $ vwrays -i myrendering.hdr < positions.txt \
    > rtrace -h [rendering options] -i+ myscene.oct \
    > rlam positions.txt - \
    > rcalc -e 'lux=47*$3+120*$4+12*$5' -o '=00 "!psign -h 25 -s -.1 ${lux}" ${$1} ${$2} \' >> pcom.sh
  $ sh pcom.sh > myluxvalues.hdr
  $ rm pcom.sh

If the text is too large or too small, adjust the psign -h value downwards or upwards as desired.

I haven't fully tested this, so I hope I didn't make any goofs. Of course, it assumes you are using Unix. Otherwise, you'll have more difficulty getting the quotes to work properly since Windows only allows double-quotes....

Best,
-Greg

···

From: Vaib <[email protected]>
Date: December 10, 2013 5:06:35 PM PST

Hello everyone,

I wish to show illuminance values at specific locations at world coordinates (x y z) in an image. I mean, to show the illuminance values (in an orthographic image of a plan created by a camera with parallel lens) at the real position of the illuminance sensors (Rtrace/Rsensor).

The only way I could find is to use Psign to produce text's image, and then position the produced text in the plan image by using Pcompos. Something like this: psign 100 Lux | pcompos inp.hdr 0 0 +t .5 - 200 200 > out.hdr. However, Pcompos takes input of the location of a pixel and places the text there. This is not what I intend to achieve.

Are there other ways to do this? Thank you in anticipation.

Best regards,
Vaibhav Jain
www.vaibhavjain.co

Hi Vaib,

You could certainly base a Perl script on some variant of the command sequence I suggested, or develop your own. For parallel views, it's not difficult to compute the world coordinates from picture position, but the other view types are more challenging.

I should have also mentioned what people more typically do is generate two images, an "irradiance" image and a regular one, then use falsecolor to combine the two into a contour plot with legend. This isn't quite what you asked for, but contains essentially the same information. I.e.:

  $ rpict [rendering options] -vf myview.vf -x [xres] -y [yres] scene.oct > myrender.hdr
  $ rpict [rendering options] -vf myview.vf -x [xres] -y [yres] -i+ scene.oct > myirradiance.hdr
  $ falsecolor -i myirradiance.hdr -p myrender.hdr -cl -s auto -l Lux > mycontour.hdr

Give it a try.
-Greg

···

From: Vaib <[email protected]>
Date: December 11, 2013 10:37:02 AM PST

Thank you Dr.Greg. I also suspected that since Pcompos deals with images (and not Radiance objects) therefore it will only take pixel coordinates (and not world coordinates) as input arguments. Your idea of recording pixel coordinates through ('t' or middle mouse button) will absolutely work but ideally I was looking for a fully automated process.

Still I think there could be one solution, if I write an algorithm to convert the (x,y) world coordinates of the sensors into (x,y) pixel coordinates by taking into account the actual room size and pixel counts of the image. If I give -vv and -vh options equal to the room size in parallel camera, and the resolution of the image produced is known than I think somehow this can be done. This is just a thought process yet. I hope this could happen. I will be glad to know your views on it. Excuse me if I confused. Thank you again!

Best regards,
Vaib

On 11 December 2013 06:44, Greg Ward <[email protected]> wrote:
Hi Vaibhav,

This is probably in the archives, somewhere, but I wouldn't want the task of trying to find it myself, so I won't insist you look, either.

If you have a list of (x,y) pixel coordinates (where x is horizontal position from the left and y is vertical position from the bottom), you can use vwrays to generate rays and compute illuminance values to composite into your image. You can generate such a list using the 't' command in ximage:

        ximage -tp myrendering.hdr > positions.txt

Just move the cursor over each place you want to compute illuminance and type 't'. Don't expect a beep or anything, and don't hold down the 't' or you'll get a whole list of identical values when it repeats. (If you prefer, you can click the middle mouse button instead of typing 't'.)

The list of positions can then be used in the following manner to generate illuminance values and output them via psign and pcompos:

        $ echo pcompos myrendering.hdr 0 0 \\ > pcom.sh
        $ vwrays -i myrendering.hdr < positions.txt \
                > rtrace -h [rendering options] -i+ myscene.oct \
                > rlam positions.txt - \
                > rcalc -e 'lux=47*$3+120*$4+12*$5' -o '=00 "!psign -h 25 -s -.1 ${lux}" ${$1} ${$2} \' >> pcom.sh
        $ sh pcom.sh > myluxvalues.hdr
        $ rm pcom.sh

If the text is too large or too small, adjust the psign -h value downwards or upwards as desired.

I haven't fully tested this, so I hope I didn't make any goofs. Of course, it assumes you are using Unix. Otherwise, you'll have more difficulty getting the quotes to work properly since Windows only allows double-quotes....

Best,
-Greg

> From: Vaib <[email protected]>
> Date: December 10, 2013 5:06:35 PM PST
>
> Hello everyone,
>
> I wish to show illuminance values at specific locations at world coordinates (x y z) in an image. I mean, to show the illuminance values (in an orthographic image of a plan created by a camera with parallel lens) at the real position of the illuminance sensors (Rtrace/Rsensor).
>
> The only way I could find is to use Psign to produce text's image, and then position the produced text in the plan image by using Pcompos. Something like this: psign 100 Lux | pcompos inp.hdr 0 0 +t .5 - 200 200 > out.hdr. However, Pcompos takes input of the location of a pixel and places the text there. This is not what I intend to achieve.
>
> Are there other ways to do this? Thank you in anticipation.
>
> Best regards,
> Vaibhav Jain
> www.vaibhavjain.co