Calculating pixel value at a specific location in an image

Hi Chris,

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

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'

Cheers,
-Greg

···

From: Chris Humann <[email protected]>
Date: April 5, 2010 4:35:52 PM MDT

My apologies for not being more specific when posting earlier. I also just realized that I missed a similar post in the archives from May 2008. However, the latter posts don't quite answer the question at hand.

I have a series of images produced from a script in which the previous image octree is over written prior to the proceeding rpict call. Given the latter condition, I don't think vwrays connected to rtrace will work as I don't have the corresponding 'octree' file.
I suppose I could write a Python Script to parse the pixel location and its associated value, but that seems a bit over kill for what seems should be a straight forward, one line task.

I'm trying to use 'pvalue' to calculate a pixel value at a specific x,y location in an image by piping 'pvalue' through 'rcalc', and am stuck on the correct syntax to use for the expression, '-e', in 'rcalc':

pvalue -o -h -H rendered_image.hdr | rcalc -e '(x_location,y_location

Thanks again.
Chris