[Radiance-general] getting pixel value at x,y

Greg Ward gregoryjward at gmail.com
Thu May 29 07:49:04 PDT 2008


Just adding my two cents to this...

The pfilt option (1) Jack suggests is a good one, and may be combined  
with the others as well.  The pcompos option (2) is a little more  
risky, as this program ignores/removes whatever exposure changes were  
made to the picture, so if it isn't straight out of rpict, you may  
get different values than you expect.  The scripting option (3) is  
very well-done, but I don't think you need to include the rayinit.cal  
file on the command line, as Jack has transcribed and modified the  
relevant functions into the -e arguments.

One other comment is if you only want a few pixels out of an image,  
vwrays connected to rtrace is much simpler and faster.  Rather than  
generating a whole picture, just use:

vwrays -i -vf view.vf -x ${xres} -y ${yres} | rtrace [options] octree

Then, on the input to vwrays, type (or redirect) the desired x and y  
pixel coordinates; vwrays will produce the corresponding ray sample,  
which rtrace will compute for you.

Finally, no one mentioned that ximage (and Photosphere and others)  
can query individual values interactively.  I don't know if this will  
work in your application.

Cheers,
-Greg

> From: Jack de Valpine <jedev at visarc.com>
> Date: May 29, 2008 7:25:58 AM PDT
>
> Hi Lars and Lucio,
>
> I can think of three possible ways to do this.
>
> 1) pfilt
> You can use pfilt to reduce the size of the image to something more  
> manageable. I am not sure (this means see what others weigh in on  
> this) but I think for some applications this may actually result in  
> better overall values in the image as surrounding pixels are being  
> averaged together by the reduction.
> 2) pcompos
> You can use pcompos to crop out an area of interest. You will have  
> to read the man page carefully to figure this out but it is  
> certainly doable.
> 3) script
> You can either write a script (perl for example) that will read the  
> stdout from pvalue and only write values within a given XY pixel  
> range or you can use radiance arcana as such:
> pvalue -h -H  +d <name_of_image.pic> | rcalc -f <path_to_lib/ 
> rayinit.cal> -e 'boundp(a, x, b) = if(a-x, 0, if(x-b, 0, 1));  
> xyboundp(xa, x, xb, ya, y, yb) = and(boundp(xa, x, xb), boundp(ya,  
> y, yb)); cond  = xyboundp( <xstart>, $1, <xend>, <ystart>, $2,  
> <yend>); $1 = $1; $2 = $2; $3 = $3; $4 = $4; $5 = $5;'
>
> This should work presuming I transcribed into my mail client  
> correctly....
>
> where you need to input:
> <name_of_image.pic>
> <path_to_lib/rayinit.cal>
> <xstart>
> <xend>
> <ystart>
> <yend>
> I hope this helps.
>
> Best,
>
> -Jack de Valpine
>
> Lars O. Grobe wrote:
>>
>> Hi list, I wonder if noone else came to this problem, or if I just  
>> do not see the answer to a rather simple problem. Radiance comes  
>> with pvalue to extract pixel values of images. This is fine, as  
>> long as images are small - just redirect to a file, and the values  
>> can be read according to the coordinates written at the beginning  
>> of the lines. Now, for large images, this becomes a pain. E.g. if  
>> I want to get the values of 64pixels, with known coordinates, I  
>> cannot read out these with pvalue, but first must transform the  
>> complete image to a pvalue formatted text file. These files can  
>> become hundreds of MB in size with higher resolutions. Is there an  
>> easier and more efficient way to go? E.g. cropping the image first  
>> to the pixels wanted? I guess the only way to do so is pcomb,  
>> right? Lars.



More information about the Radiance-general mailing list