extracting brightness values from picture

Hi all,

I have a question regarding extracting values from a pic file (pvalue
program?).

- Is there a way to extract the values just for a portion of
picture (rather than getting it for a single pixel or the whole picture)?

- Also, are we able to get values just for an irregular polygon
portion of the picture?

Thanks a lot.

Prasanta

···

_________________________________________

Prasanta Bhattarai

(Junior Research Associate)

Environmental Simulation Center
261 W. 35th St
New York, NY 10001
Email: [email protected]
Office: 212-279-1851
Fax: 212-279-5350

Are you an a Mac?
Photosphere allows you to draw a rectangle anywhere on the pic and it shows values.
No way to get an irregular polygon as far as I know.

Rob F

···

-----Original Message-----
From: [email protected] on behalf of Prasanta Bhattarai
Sent: Thu 1/3/2008 10:11 AM
To: 'Radiance general discussion'
Subject: [Radiance-general] extracting brightness values from picture

Hi all,

I have a question regarding extracting values from a pic file (pvalue
program?).

- Is there a way to extract the values just for a portion of
picture (rather than getting it for a single pixel or the whole picture)?

- Also, are we able to get values just for an irregular polygon
portion of the picture?

Thanks a lot.

Prasanta

_________________________________________

Prasanta Bhattarai

(Junior Research Associate)

Environmental Simulation Center
261 W. 35th St
New York, NY 10001
Email: [email protected]
Office: 212-279-1851
Fax: 212-279-5350

Hello Prasanta,

As Rob points out, Photosphere may be used to compute the average value for a portion of an image. The ximage viewer may be used in the same way. If you need this computed in "batch mode" or want all the pixel values for a rectangular section, you can pass the picture through pcompos before sending it to pvalue. (However, be aware that the -o option of pvalue will not work for pictures passed through pcompos.)

There is no convenient facility to get the pixels from a non-rectangular region of a picture, but using the following syntax:

  pvalue -o -h -H result.pic | rcalc -e 'cond=func($1,$2)' -e '$1=179*(.265*$3+.670*$4+.065*$5)'

you can produce the luminance values for every pixel where func(x,y) is greater than zero. Naturally, you must define this function also on the rcalc command line, and creating one for a polygon is not that easy. An example function that would get luminance values along a diagonal extending from the lower-left of the image to the upper-right would be:

  -e 'func(x,y)=equal(x,y);equal(a,b):if(a-b+.5,b-a+.5,-1)'

I hope this makes some kind of sense.

If you have a way to create the mask you want on the image (in Photoshop or whatever), you can use the following nonsense to average over only these values. (I assume the input mask is in PPM format, but it could be TIFF or whatever.)

        ra_ppm -r mask.ppm \
                 > pvalue -h -H -pG -df \
                 > rlam -if - "\!pvalue -h -H -o -b -df result.pic" \
                 > rcalc -if2 -of -e 'cond=$1-.5;$1=$2' \
                 > total -if -m

The backslash before the exclamation mark is only necessary for the C-shell, so you might have to remove that.

Best,
-Greg

···

From: "Prasanta Bhattarai" <[email protected]>
Date: January 3, 2008 8:11:06 AM PST
Hi all,

I have a question regarding extracting values from a pic file (pvalue program?).

- Is there a way to extract the values just for a portion of picture (rather than getting it for a single pixel or the whole picture)?

- Also, are we able to get values just for an irregular polygon portion of the picture?

Thanks a lot.

Prasanta

_________________________________________

Prasanta Bhattarai

Thanks Greg & Rob for your quick response.

I am using radiance on Linux and I am relatively a new user (both
radiance & Linux). I'm sure it's going to take some time for me to
understand Greg's syntax and be able to use it. So for now, I will try
to find a Mac and do calculations on photosphere.

Thank You so much.

Prasanta

···

-----Original Message-----
From: Greg Ward [mailto:[email protected]]
Sent: Thursday, January 03, 2008 2:16 PM
To: Radiance general discussion
Subject: Re: [Radiance-general] extracting brightness values from
picture

Hello Prasanta,

As Rob points out, Photosphere may be used to compute the average
value for a portion of an image. The ximage viewer may be used in
the same way. If you need this computed in "batch mode" or want all
the pixel values for a rectangular section, you can pass the picture
through pcompos before sending it to pvalue. (However, be aware that
the -o option of pvalue will not work for pictures passed through
pcompos.)

There is no convenient facility to get the pixels from a non-
rectangular region of a picture, but using the following syntax:

  pvalue -o -h -H result.pic | rcalc -e 'cond=func($1,$2)' -e
'$1=179*
(.265*$3+.670*$4+.065*$5)'

you can produce the luminance values for every pixel where func(x,y)
is greater than zero. Naturally, you must define this function also
on the rcalc command line, and creating one for a polygon is not that
easy. An example function that would get luminance values along a
diagonal extending from the lower-left of the image to the upper-
right would be:

  -e 'func(x,y)=equal(x,y);equal(a,b):if(a-b+.5,b-a+.5,-1)'

I hope this makes some kind of sense.

If you have a way to create the mask you want on the image (in
Photoshop or whatever), you can use the following nonsense to average
over only these values. (I assume the input mask is in PPM format,
but it could be TIFF or whatever.)

        ra_ppm -r mask.ppm \
                 > pvalue -h -H -pG -df \
                 > rlam -if - "\!pvalue -h -H -o -b -df result.pic" \
                 > rcalc -if2 -of -e 'cond=$1-.5;$1=$2' \
                 > total -if -m

The backslash before the exclamation mark is only necessary for the C-
shell, so you might have to remove that.

Best,
-Greg

From: "Prasanta Bhattarai" <[email protected]>
Date: January 3, 2008 8:11:06 AM PST
Hi all,

I have a question regarding extracting values from a pic file
(pvalue program?).

- Is there a way to extract the values just for a
portion of picture (rather than getting it for a single pixel or
the whole picture)?

- Also, are we able to get values just for an irregular
polygon portion of the picture?

Thanks a lot.

Prasanta

_________________________________________

Prasanta Bhattarai

As I said, you can also select a region in ximage and use the 'l' key to get luminance that way. And to correct a missing conversion factor in my luminance calculation using a mask, the command should have read:

         ra_ppm -r mask.ppm \
                  > pvalue -h -H -pG -df \
                  > rlam -if - "\!pvalue -h -H -o -b -df result.pic" \
                  > rcalc -if2 -of -e 'cond=$1-.5;$1=179*$2' \
                  > total -if -m

-Greg

···

From: "Prasanta Bhattarai" <[email protected]>
Date: January 7, 2008 6:48:17 AM PST

Thanks Greg & Rob for your quick response.

I am using radiance on Linux and I am relatively a new user (both
radiance & Linux). I'm sure it's going to take some time for me to
understand Greg's syntax and be able to use it. So for now, I will try
to find a Mac and do calculations on photosphere.

Thank You so much.

Prasanta

Thanks Greg.

Prasanta

···

-----Original Message-----
From: Greg Ward [mailto:[email protected]]
Sent: Monday, January 07, 2008 11:31 AM
To: Radiance general discussion
Subject: Re: [Radiance-general] extracting brightness values from
picture

As I said, you can also select a region in ximage and use the 'l' key
to get luminance that way. And to correct a missing conversion
factor in my luminance calculation using a mask, the command should
have read:

         ra_ppm -r mask.ppm \
                  > pvalue -h -H -pG -df \
                  > rlam -if - "\!pvalue -h -H -o -b -df result.pic" \
                  > rcalc -if2 -of -e 'cond=$1-.5;$1=179*$2' \
                  > total -if -m

-Greg

From: "Prasanta Bhattarai" <[email protected]>
Date: January 7, 2008 6:48:17 AM PST

Thanks Greg & Rob for your quick response.

I am using radiance on Linux and I am relatively a new user (both
radiance & Linux). I'm sure it's going to take some time for me to
understand Greg's syntax and be able to use it. So for now, I will try
to find a Mac and do calculations on photosphere.

Thank You so much.

Prasanta

Hi Prasanta,

I'm not sure how (in terms of code) you're trying to extract the luminance values and how you'd be processing them, but I've faced a similar task some time back and tried to document the syntax in a easy-to-reuse way.

http://www.yichunhuang.com/radiance_pic/rgbe.html

at the bottom of the page, I've included a draft java file that eventually allowed me to access pixel values easily. (Did not have time to update with latest files...) Hope this is useful.

Cheers,
YC Huang
Center for Building Performance and Diagnostics
Carnegie Mellon University

···

_________________________________________________________________
Easily manage multiple email accounts with Windows Live Mail!
http://www.get.live.com/wl/all