Falsecolor tricks

Hi All -

I'd like to make falsecolor stamp an image with a value for a single pixel of my choosing (say at 250, 300 in a 1000px x 700px image), similar to how -e works. This is to show irradiance levels changing at a given point in a sequential animation. Anybody have a trick to do this, or something like it?

Thanks very much,
Mike

Michael Martinez ~ Associate
LOISOS + UBBELOHDE
- - - - - - - - - - - - - - - - - - - - - - - - - - -
1917 Clement Avenue Building 10A
Alameda, CA 94501 USA
- - - - - - - - - - - - - - - - - - - - - - - - - - -
510 521 3800 VOICE
510 521 3820 FAX
- - - - - - - - - - - - - - - - - - - - - - - - - - -
www.coolshadow.com

If you can live with a manual method you can use wxfalsecolor to label a point and then save the image including the label (ldr only).
Otherwise look at pvalue and psign.

Regards, Thomas

···

Michael Martinez <[email protected]> wrote:

Hi All -

I'd like to make falsecolor stamp an image with a value for a single
pixel of my choosing (say at 250, 300 in a 1000px x 700px image),
similar to how -e works. This is to show irradiance levels changing at
a given point in a sequential animation. Anybody have a trick to do
this, or something like it?

Thanks very much,
Mike

Michael Martinez ~ Associate
LOISOS + UBBELOHDE
- - - - - - - - - - - - - - - - - - - - - - - - - - -
1917 Clement Avenue Building 10A
Alameda, CA 94501 USA
- - - - - - - - - - - - - - - - - - - - - - - - - - -
510 521 3800 VOICE
510 521 3820 FAX
- - - - - - - - - - - - - - - - - - - - - - - - - - -
www.coolshadow.com

------------------------------------------------------------------------

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

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Hi Michael,

I had asked a similar question several years ago on how to extract a value at a specific pixel location in the original HDR image. Greg responded with the following (you'll have to pass the result to the equivalent pixel location in the false color HDR using psign piped into pcompos *don't forget to add the pixel width of the false color scale to the x-location in the false color image);

From Greg…….
If you haven't passed the picture through pfilt or otherwise introduced an exposure change, then it would be much faster to use pcompos to extract the value you're interested in. E.g.:

  pcompos -x 1 -y 1 rendered_image.hdr -Xpos -Ypos | pvalue -h -H -d | rcalc -e '$1=($1*0.265+$2*0.670+$3*0.065)*179'

If getinfo shows one or more EXPOSURE= lines in the header, then the above won't quite work and you'll need to use pvalue. The syntax for the command you want is:

  pvalue -o -h -H rendered_image.hdr | rcalc -e 'eq(a,b):if(a-b+.5,b-a+.5,-1);and(a,b):if(a,b,a)' \
    -e 'cond=and(eq($1,x_location),eq($2,y_location))' -e '$1=$3;$2=$4;$3=$5'

Nasty, eh? It's also slow. Use pcompos if you can. A faster alternative to the above is to use sed:

  pvalue -o -h -H rendered_image.hdr | sed -n 's/^ *x_location *y_location //p'

EXAMPLE:
pvalue -o -h -H dec_cie_43-63tvis_dome_sit_west.hdr | sed -n 's/^ *284 *248 //p' | rcalc -e \ '$1=($1*0.265+$2*0.670+$3*0.065)*179' > value.txt

···

_________________________

For the second part

ex:
psign -cf 1 1 1 -cb 0 0 0 -h 16 the_value_from above | pompos falsecolor_image.hdr +t .5 - x_location y_location > image_out.hdr

Hope this helps,

Chris
On Sep 24, 2013, at 1:25 PM, Michael Martinez <[email protected]> wrote:

Hi All -

I'd like to make falsecolor stamp an image with a value for a single pixel of my choosing (say at 250, 300 in a 1000px x 700px image), similar to how -e works. This is to show irradiance levels changing at a given point in a sequential animation. Anybody have a trick to do this, or something like it?

Thanks very much,
Mike

Michael Martinez ~ Associate
LOISOS + UBBELOHDE
- - - - - - - - - - - - - - - - - - - - - - - - - - -
1917 Clement Avenue Building 10A
Alameda, CA 94501 USA
- - - - - - - - - - - - - - - - - - - - - - - - - - -
510 521 3800 VOICE
510 521 3820 FAX
- - - - - - - - - - - - - - - - - - - - - - - - - - -
www.coolshadow.com

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

Hi Mike,

You probably need to hack falsecolor if you want it to appear in the right place with the legend and everything. Look for pextrem and think about how you would replace it with something that pulled out the desired pixel value like so:

  $xpos = 250
  $ypos = 300
  $lumval = `ra_xyze -o orig.hdr | pcompos -x 1 -y 1 - -$xpos -$ypos | pvalue -h -H -b -d`
  psign -s -.15 -a 2 -h 16 $lumval | pcompos falsecolor.hdr 0 0 - $xpos $ypos > composite.hdr

The ra_xyze command is to undo any exposure setting before passing on to pcompos to pull out the desired pixel, and is unnecessary and inefficient if your picture hasn't been processed by pfilt or anything that added an EXPOSURE= line.

I hope these hints get you going in the right direction.

-Greg

···

From: Michael Martinez <[email protected]>
Date: September 24, 2013 1:25:14 PM PDT

Hi All -

I'd like to make falsecolor stamp an image with a value for a single pixel of my choosing (say at 250, 300 in a 1000px x 700px image), similar to how -e works. This is to show irradiance levels changing at a given point in a sequential animation. Anybody have a trick to do this, or something like it?

Thanks very much,
Mike

Funny -- I guess I'm repeating myself! I didn't think of using ra_xyze -o before, though, so maybe a slight improvement...

-Greg

···

From: Christian Humann <[email protected]>
Date: September 24, 2013 2:54:04 PM PDT

Hi Michael,

I had asked a similar question several years ago on how to extract a value at a specific pixel location in the original HDR image. Greg responded with the following (you'll have to pass the result to the equivalent pixel location in the false color HDR using psign piped into pcompos *don't forget to add the pixel width of the false color scale to the x-location in the false color image);

From Greg…….
If you haven't passed the picture through pfilt or otherwise introduced an exposure change, then it would be much faster to use pcompos to extract the value you're interested in. E.g.:

  pcompos -x 1 -y 1 rendered_image.hdr -Xpos -Ypos | pvalue -h -H -d | rcalc -e '$1=($1*0.265+$2*0.670+$3*0.065)*179'

If getinfo shows one or more EXPOSURE= lines in the header, then the above won't quite work and you'll need to use pvalue. The syntax for the command you want is:

  pvalue -o -h -H rendered_image.hdr | rcalc -e 'eq(a,b):if(a-b+.5,b-a+.5,-1);and(a,b):if(a,b,a)' \
    -e 'cond=and(eq($1,x_location),eq($2,y_location))' -e '$1=$3;$2=$4;$3=$5'

Nasty, eh? It's also slow. Use pcompos if you can. A faster alternative to the above is to use sed:

  pvalue -o -h -H rendered_image.hdr | sed -n 's/^ *x_location *y_location //p'

EXAMPLE:
pvalue -o -h -H dec_cie_43-63tvis_dome_sit_west.hdr | sed -n 's/^ *284 *248 //p' | rcalc -e \ '$1=($1*0.265+$2*0.670+$3*0.065)*179' > value.txt
_________________________

For the second part

ex:
psign -cf 1 1 1 -cb 0 0 0 -h 16 the_value_from above | pompos falsecolor_image.hdr +t .5 - x_location y_location > image_out.hdr

Hope this helps,

Chris
On Sep 24, 2013, at 1:25 PM, Michael Martinez <[email protected]> wrote:

Hi All -

I'd like to make falsecolor stamp an image with a value for a single pixel of my choosing (say at 250, 300 in a 1000px x 700px image), similar to how -e works. This is to show irradiance levels changing at a given point in a sequential animation. Anybody have a trick to do this, or something like it?

Thanks very much,
Mike

thanks guys, this is very helpful. I like that asking the same question twice over time ends up with multiple solutions :slight_smile:

···

On Sep 24, 2013, at 3:21 PM, Greg Ward wrote:

Funny -- I guess I'm repeating myself! I didn't think of using ra_xyze -o before, though, so maybe a slight improvement...

-Greg

From: Christian Humann <[email protected]>
Date: September 24, 2013 2:54:04 PM PDT

Hi Michael,

I had asked a similar question several years ago on how to extract a value at a specific pixel location in the original HDR image. Greg responded with the following (you'll have to pass the result to the equivalent pixel location in the false color HDR using psign piped into pcompos *don't forget to add the pixel width of the false color scale to the x-location in the false color image);

From Greg…….
If you haven't passed the picture through pfilt or otherwise introduced an exposure change, then it would be much faster to use pcompos to extract the value you're interested in. E.g.:

  pcompos -x 1 -y 1 rendered_image.hdr -Xpos -Ypos | pvalue -h -H -d | rcalc -e '$1=($1*0.265+$2*0.670+$3*0.065)*179'

If getinfo shows one or more EXPOSURE= lines in the header, then the above won't quite work and you'll need to use pvalue. The syntax for the command you want is:

  pvalue -o -h -H rendered_image.hdr | rcalc -e 'eq(a,b):if(a-b+.5,b-a+.5,-1);and(a,b):if(a,b,a)' \
    -e 'cond=and(eq($1,x_location),eq($2,y_location))' -e '$1=$3;$2=$4;$3=$5'

Nasty, eh? It's also slow. Use pcompos if you can. A faster alternative to the above is to use sed:

  pvalue -o -h -H rendered_image.hdr | sed -n 's/^ *x_location *y_location //p'

EXAMPLE:
pvalue -o -h -H dec_cie_43-63tvis_dome_sit_west.hdr | sed -n 's/^ *284 *248 //p' | rcalc -e \ '$1=($1*0.265+$2*0.670+$3*0.065)*179' > value.txt
_________________________

For the second part

ex:
psign -cf 1 1 1 -cb 0 0 0 -h 16 the_value_from above | pompos falsecolor_image.hdr +t .5 - x_location y_location > image_out.hdr

Hope this helps,

Chris
On Sep 24, 2013, at 1:25 PM, Michael Martinez <[email protected]> wrote:

Hi All -

I'd like to make falsecolor stamp an image with a value for a single pixel of my choosing (say at 250, 300 in a 1000px x 700px image), similar to how -e works. This is to show irradiance levels changing at a given point in a sequential animation. Anybody have a trick to do this, or something like it?

Thanks very much,
Mike

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

Hi folks - one more question about falsecolor hacks.

any chance one could make -e in falsecolor return not the extrema pixels, but the extrema pixels averaged by their immediate neighbors (8 surrounding pixels), or possibly an even larger radius or neighboring pixels? in other words, i'd like to highlight the maximum value on a set of images, but instead of a single point, a larger 'extrema zone' on the image.

Thanks for any ideas...

MM

···

On Sep 24, 2013, at 3:21 PM, Greg Ward wrote:

Funny -- I guess I'm repeating myself! I didn't think of using ra_xyze -o before, though, so maybe a slight improvement...

-Greg

From: Christian Humann <[email protected]>
Date: September 24, 2013 2:54:04 PM PDT

Hi Michael,

I had asked a similar question several years ago on how to extract a value at a specific pixel location in the original HDR image. Greg responded with the following (you'll have to pass the result to the equivalent pixel location in the false color HDR using psign piped into pcompos *don't forget to add the pixel width of the false color scale to the x-location in the false color image);

From Greg…….
If you haven't passed the picture through pfilt or otherwise introduced an exposure change, then it would be much faster to use pcompos to extract the value you're interested in. E.g.:

  pcompos -x 1 -y 1 rendered_image.hdr -Xpos -Ypos | pvalue -h -H -d | rcalc -e '$1=($1*0.265+$2*0.670+$3*0.065)*179'

If getinfo shows one or more EXPOSURE= lines in the header, then the above won't quite work and you'll need to use pvalue. The syntax for the command you want is:

  pvalue -o -h -H rendered_image.hdr | rcalc -e 'eq(a,b):if(a-b+.5,b-a+.5,-1);and(a,b):if(a,b,a)' \
    -e 'cond=and(eq($1,x_location),eq($2,y_location))' -e '$1=$3;$2=$4;$3=$5'

Nasty, eh? It's also slow. Use pcompos if you can. A faster alternative to the above is to use sed:

  pvalue -o -h -H rendered_image.hdr | sed -n 's/^ *x_location *y_location //p'

EXAMPLE:
pvalue -o -h -H dec_cie_43-63tvis_dome_sit_west.hdr | sed -n 's/^ *284 *248 //p' | rcalc -e \ '$1=($1*0.265+$2*0.670+$3*0.065)*179' > value.txt
_________________________

For the second part

ex:
psign -cf 1 1 1 -cb 0 0 0 -h 16 the_value_from above | pompos falsecolor_image.hdr +t .5 - x_location y_location > image_out.hdr

Hope this helps,

Chris
On Sep 24, 2013, at 1:25 PM, Michael Martinez <[email protected]> wrote:

Hi All -

I'd like to make falsecolor stamp an image with a value for a single pixel of my choosing (say at 250, 300 in a 1000px x 700px image), similar to how -e works. This is to show irradiance levels changing at a given point in a sequential animation. Anybody have a trick to do this, or something like it?

Thanks very much,
Mike

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

Yes, it's possible. You just need to hack falsecolor.

Is that the answer you're looking for?

More detailed: Use pfilt to box-filter the image, then run pextrem on the output. Upscale the positions it gives you and reinsert them in the appropriate place in the code.

An option to do this could be added if it's of general interest. Axel Jacobs is the maintainer of falsecolor.pl these days.

Cheers,
-Greg

···

From: Michael Martinez <[email protected]>
Date: November 12, 2013 11:42:11 AM PST

Hi folks - one more question about falsecolor hacks.

any chance one could make -e in falsecolor return not the extrema pixels, but the extrema pixels averaged by their immediate neighbors (8 surrounding pixels), or possibly an even larger radius or neighboring pixels? in other words, i'd like to highlight the maximum value on a set of images, but instead of a single point, a larger 'extrema zone' on the image.

Thanks for any ideas...

MM

On Sep 24, 2013, at 3:21 PM, Greg Ward wrote:

Funny -- I guess I'm repeating myself! I didn't think of using ra_xyze -o before, though, so maybe a slight improvement...

-Greg

From: Christian Humann <[email protected]>
Date: September 24, 2013 2:54:04 PM PDT

Hi Michael,

I had asked a similar question several years ago on how to extract a value at a specific pixel location in the original HDR image. Greg responded with the following (you'll have to pass the result to the equivalent pixel location in the false color HDR using psign piped into pcompos *don't forget to add the pixel width of the false color scale to the x-location in the false color image);

From Greg…….
If you haven't passed the picture through pfilt or otherwise introduced an exposure change, then it would be much faster to use pcompos to extract the value you're interested in. E.g.:

  pcompos -x 1 -y 1 rendered_image.hdr -Xpos -Ypos | pvalue -h -H -d | rcalc -e '$1=($1*0.265+$2*0.670+$3*0.065)*179'

If getinfo shows one or more EXPOSURE= lines in the header, then the above won't quite work and you'll need to use pvalue. The syntax for the command you want is:

  pvalue -o -h -H rendered_image.hdr | rcalc -e 'eq(a,b):if(a-b+.5,b-a+.5,-1);and(a,b):if(a,b,a)' \
    -e 'cond=and(eq($1,x_location),eq($2,y_location))' -e '$1=$3;$2=$4;$3=$5'

Nasty, eh? It's also slow. Use pcompos if you can. A faster alternative to the above is to use sed:

  pvalue -o -h -H rendered_image.hdr | sed -n 's/^ *x_location *y_location //p'

EXAMPLE:
pvalue -o -h -H dec_cie_43-63tvis_dome_sit_west.hdr | sed -n 's/^ *284 *248 //p' | rcalc -e \ '$1=($1*0.265+$2*0.670+$3*0.065)*179' > value.txt
_________________________

For the second part

ex:
psign -cf 1 1 1 -cb 0 0 0 -h 16 the_value_from above | pompos falsecolor_image.hdr +t .5 - x_location y_location > image_out.hdr

Hope this helps,

Chris
On Sep 24, 2013, at 1:25 PM, Michael Martinez <[email protected]> wrote:

Hi All -

I'd like to make falsecolor stamp an image with a value for a single pixel of my choosing (say at 250, 300 in a 1000px x 700px image), similar to how -e works. This is to show irradiance levels changing at a given point in a sequential animation. Anybody have a trick to do this, or something like it?

Thanks very much,
Mike

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

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

Hi Michael,

the question of extracting certain regions of interest from an HDR occupied me a couple of years ago. The box filter approach that Greg is suggesting is certainly doable. However, if you want more than the neighbouring 8 pixel, you will have to think about how useful a 'box' is as opposed to all pixels within a certain radius, ie a 'circle'.

If you take this a little further (and out of your FC context), then you might wish to extract a number of shapes from an HDR image:
- circles, ellipses
- squares, rectangles
- points
- lines
- polygons
- masked areas (b/w HDR image)

The latter is easily doable, but all the other shapes are not, unless they are cast into a mask first. Well, I supposed arbitrary 'boxes' can be done, too.

Back then, I wrote a Python script that I named pextract. It never worked to my complete satisfaction, mostly because it was agonisingly slow. It took several minutes for a 3 or so megapixel HDR to be processed. Part of the reason might be that this was a pure Python HDR reader, and I did very little in terms of optimising the RGBE parser.

Help output is below to give you an idea of what it did:

$ pyray_pextract.py -h
Usage: pyray_pextract.py [options] file.hdr

Exactly one action is required.

Options:
   --version show program's version number and exit
   -h, --help show this help message and exit
   -f, --flip The origin of an HDR image is at the bottom-left
                         corner. This switch inverts the row order, putting the
                         origin at the top-left. This is the convention for
                         most image processing software [default: False].
   -a, --all Instead of dropping all pixels outside of the shape,
                         colour them black and output them, too. This can be
                         used for reverse-assembling a new HDR image, and is
                         useful for testing and debugging.
   -d, --data-only Output data only, do not print x and y pixel position.

   Actions:
     -l x0,y0,x1,y1, --line=x0,y0,x1,y1
                         Extract values along a line.
     -r x0,y0,x1,y1, --rectangle=x0,y0,x1,y1
                         Extract values inside a rectangle.
     -e x0,y0,x1,y1, --ellipse=x0,y0,x1,y1
                         Extract values inside an ellipse.
     -p x0,y0,x1,y1,...,xn,yn, --polygon=x0,y0,x1,y1,...,xn,yn
                         Extract values inside a polygon.

What I am trying to say with all this is this: Yes, a box shaped extreme is doable, but I wonder how much use it would be for anything other than a VERY specific purpose. It is also easy enough to create a circular b/w mask with pcomb and link this mask into FC, but this would put all sorts of if and but statements into the FC code, and might quickly become ugly. In all likelihood, you will also wish to indicate the box/circle coordinates in the legend or a caption, since by just looking at the FC image, it would not be apparent how the label got there, and what it represents.

In that sense, I'd be inclined to say that the 'value at specific x,y' you mentioned in your earlier post would probably be more generally useful. As it happens, I am currently working at a project where exactly this functionality might be required. My quick-n-dirty approach would be to extract the value with pvalue, grep for the pixel, then stick the label onto the FC image (or even the LDR image--ImageMagick is pretty cool) afterwards. I might look into this as a new feature for FC if there is general interest.

Regards

Axel

···

On 12/11/13 20:10, Greg Ward wrote:

Yes, it's possible. You just need to hack falsecolor.

Is that the answer you're looking for?

More detailed: Use pfilt to box-filter the image, then run pextrem on
the output. Upscale the positions it gives you and reinsert them in the
appropriate place in the code.

An option to do this could be added if it's of general interest. Axel
Jacobs is the maintainer of falsecolor.pl <http://falsecolor.pl> these days.

Cheers,
-Greg

*From: *Michael Martinez <[email protected]
<mailto:[email protected]>>

*Date: *November 12, 2013 11:42:11 AM PST

*

Hi folks - one more question about falsecolor hacks.

any chance one could make -e in falsecolor return not the extrema
pixels, but the extrema pixels averaged by their immediate neighbors
(8 surrounding pixels), or possibly an even larger radius or
neighboring pixels? in other words, i'd like to highlight the maximum
value on a set of images, but instead of a single point, a larger
'extrema zone' on the image.

Thanks for any ideas...

MM

On Sep 24, 2013, at 3:21 PM, Greg Ward wrote:

Funny -- I guess I'm repeating myself! I didn't think of using
ra_xyze -o before, though, so maybe a slight improvement...

-Greg

*From: *Christian Humann <[email protected]
<mailto:[email protected]>>
*Date: *September 24, 2013 2:54:04 PM PDT
*
Hi Michael,

I had asked a similar question several years ago on how to extract a
value at a specific pixel location in the original HDR image. Greg
responded with the following (you'll have to pass the result to the
equivalent pixel location in the false color HDR using psign piped
into pcompos *don't forget to add the pixel width of the false color
scale to the x-location in the false color image);

From Greg…….
If you haven't passed the picture through pfilt or otherwise
introduced an exposure change, then it would be much faster to use
pcompos to extract the value you're interested in. E.g.:

pcompos -x 1 -y 1 rendered_image.hdr -Xpos -Ypos | pvalue -h -H -d |
rcalc -e '$1=($1*0.265+$2*0.670+$3*0.065)*179'

If getinfo shows one or more EXPOSURE= lines in the header, then the
above won't quite work and you'll need to use pvalue. The syntax
for the command you want is:

pvalue -o -h -H rendered_image.hdr | rcalc -e
'eq(a,b):if(a-b+.5,b-a+.5,-1);and(a,b):if(a,b,a)' \
-e 'cond=and(eq($1,x_location),eq($2,y_location))' -e
'$1=$3;$2=$4;$3=$5'

Nasty, eh? It's also slow. Use pcompos if you can. A faster
alternative to the above is to use sed:

pvalue -o -h -H rendered_image.hdr | sed -n 's/^ *x_location
*y_location //p'

EXAMPLE:
pvalue -o -h -H dec_cie_43-63tvis_dome_sit_west.hdr | sed -n 's/^
*284 *248 //p' | rcalc -e \ '$1=($1*0.265+$2*0.670+$3*0.065)*179' >
value.txt
_________________________

For the second part

ex:
psign -cf 1 1 1 -cb 0 0 0 -h 16 the_value_from above | pompos
falsecolor_image.hdr +t .5 - x_location y_location > image_out.hdr

Hope this helps,

Chris
On Sep 24, 2013, at 1:25 PM, Michael Martinez >>>> <[email protected] <mailto:[email protected]>> wrote:

Hi All -

I'd like to make falsecolor stamp an image with a value for a
single pixel of my choosing (say at 250, 300 in a 1000px x 700px
image), similar to how -e works. This is to show irradiance levels
changing at a given point in a sequential animation. Anybody have a
trick to do this, or something like it?

Thanks very much,
Mike