[Radiance-general] Average luminance calculation
Gregory J. Ward
gregoryjward at gmail.com
Tue Jun 14 20:44:13 CEST 2005
Hi Jay,
You have to offer us some clues as to how you are attempting this
calculation. The website you give shows a bunch of JPEG thumbnails.
Are you converting those? It seems that the author of this page is
converting them without considering gamma, then computing the log of
the non-linear gray values, which is basically nonsense. However, in
the interest of reproducing their results, you can use:
% djpeg egret2.jpg | ra_ppm -r -g 1 \
| pvalue -h -H -d -b | rcalc -e '$1=log($1)' | total -m
Using the egret pictures, this then gives:
-2.08354495
To get the final log-average luminance, simply apply the exponent
function:
% ev 'exp(-2.0835)'
This yeilds:
0.124493721
Not exactly the 0.1212 value they give on the website, but close.
Note that I didn't use a delta value in my calculation, but adding
one should raise this value rather than lower it. A more intelligent
application of log averaging would apply a gamma to get back to a
linear color space, e.g.:
% djpeg egret2.jpg | ra_ppm -r -g 2.4 \
| pvalue -h -H -d -b | rcalc -e '$1=log($1)' | total -m
Apply the exp() function to this result gives a much smaller result:
0.00687406256
-Greg
> From: Jay <jpothara at uccs.edu>
> Date: June 14, 2005 10:37:17 AM PDT
>
> Hi people,
> I am trying to calculate contrast for images. I am referring to
> paper (http://diuf.unifr.ch/courses03-04/imaging/simoncelli.pdf).
> This paper suggest that to calculate contrast luminance is first
> needs to be calculated.
> I am calculating lumninance using the formula.
> L_w = exp[ 1 / N( sum[ log( delta + L_w ( x, y ) ) ] ) ]
>
> Where:
>
> * L_w - log-average luminance
> * N - number of pixels in the image
> * delta - a small factor to avoid problems with black pixels
> * L_w ( x, y ) - the world space luminance for pixel ( x, y )
>
> where log has base e.
>
> I am using the image from http://www.cacs.louisiana.edu/~cice/lal/.
> i cant get the luminance values mentioned on the website.
> Can someone please tell me where am i going wrong.
>
> thanks
> Jay
More information about the Radiance-general
mailing list