1
\$\begingroup\$

I need to calculate average gamma from 9-step grayscale.

HCFR gamma graph

I have a grayscale measurement export from HCFR.

I can calculate gamma for every gray step like this:

calculate gamma from measurement

Row A is the grayscale measurement pattern from 0 % to 100 % (I don't know why HCFR give those odd values ...) I normalize the values (row B) and logarithmize them (row C). And now I do the same for the measured values (row E, F & G).

To get gamma I take the slope so basically for one value of the row it would be:

Gamma = (C * G) / C²

As you can see I can calculate exactly those values HCFR gives me in gamma graph of the measurement.

But I really don't know how to get the values for the average gamma. The HCFR gamma graph give me 2.179 for that. How is it calculated?

I found someone on the web who did the same: https://www.marcelpatek.com/gamma.html#loggamma In his excel sheet (https://www.marcelpatek.com/download/Gray_XYZ.xls) in table "Gray" cell N4 he calculated average gamma from the grayscale but for calculation he took only the values from 55 % to 100 %. I don't know why but this also wouldn't give me the correct (HCFR) values.

\$\endgroup\$
3
  • \$\begingroup\$ Could you explain the photographic problem you're trying to solve here? In general, image processing questions unrelated to actual photography are off-topic on this site. \$\endgroup\$
    – Philip Kendall
    Commented Apr 14 at 19:15
  • 2
    \$\begingroup\$ If Gamma = (C * G) / C² then Gamma=G/C, Gamma isn't well defined for 0 (which is why the SRGB profile is not a plain power function and is linear for the very low values. \$\endgroup\$
    – xenoid
    Commented Apr 14 at 21:20
  • \$\begingroup\$ I think maybe theres a bug in the spreadsheet. Every type of mean I can find for that set of numbers is about 2.165 due to that 2.06 \$\endgroup\$
    – davolfman
    Commented May 17 at 23:06

2 Answers 2

0
\$\begingroup\$

enter image description hereenter image description hereI think the Gamma in digital imagining as used today stems from Sensitometry / Densitometry. Sensitometry is the science of precision exposing films and papers and Densitometry is the science of precision measuring the developed materials. For most applications films were exposed to make a gray scale from Dmin to Dmax in ½ f-stop increments. For pictorial films, the results were typically making a gray scale consisting of 21 steps.

Each step was measured using a Densitometer that returned the optical density of each step. The math used was to measure the light absorption of each step and presenting its density as a log value.

Now each f-stop increment is a 2X (double) of the exposing energy. The 2 value of this increment is expressed as a logarithm base 10. Thus, the number 2 is 10 elevated to the 0.30 power. For 1/6 f-stop = 0.05 1/3 f-stop = 0.10 1/2 f-stop = 0.15 2/3 f-stop = 0.20 1 f-stop = 0.30 2 f-stop = 0.60 3 f-stop = 0.90 4 f-stop = 1.20 5 f-stop = 1.5.

These values are written dropping the base which is 10 as this is unnecessary reputation. Therefor only the exponent of the logarithm is written.

Standard practice is to graph the values of each of the 21 steps using log graph paper. The result is the left half of a bell-shaped curve. The graph slopes upward. Using a proctor, we measured the angle of slope of the graph. The tan of this angle is Gamma.

If the gamma was 1 then the average slope angle is 45⁰. If true, 1 f-stop exposure induces a 2X change in density = 0.30 log change. Now most pictorial films have a upward slope that is less than 1. Typical is 38.7⁰. Its tan is 0.8. Thus, a typical pictorial film has a Gamma of 0.8. This tells me that the density change per f-stop is 0.30 X 0.8 = 0.24 density units per f-stop increment.

If the Gamma is 2 (typical of higher contrast films), then the delta per f-stop = 0.60 density.

I think this is the basis for Gamma used in TV and computer monitors.

For the film plot, the Stright Line slope angle is 45 degrees. The tan of 45 is 1. The Gamma for this plot is 1. Also attached is Kodak 21 step gray scale with densities and RGB values for two different Gammas for computer monitor.

If the density of a patch is known, how to derive the corresponding RGB value: Take step 10, its density is 1.05. Divide this density by the Gamma setting of the monitor – likely 2.2 = 0.47727. Now elevate 10^0.47727 = 3.001. Now divide 255 by 3.001 = 84.9. This is the RGB value of step 10.

\$\endgroup\$
0
\$\begingroup\$

Arguably you should only need 2 or 3 points to calculate gamma if a curve is actually just gamma. You measure the darkest point as zero, the brightest point as 1.0. You then take measure the middle point, subtract the black point, and scale it relative to the brightest point. You take that measurement and the value that was used to create it (also scaled to 0.0-1.0) and figure out what power that input value had to be raised to to get you your output value.

The math should go something like this for (O)utput, (Input), and (G)amma:

$$\begin{align} O &= I^G \\ \log{O} &= \log{I^G} \\ \log{O} &= \log{I}*G \\ {\log{O}\over\log{I}} &= G \end{align}$$

\$\endgroup\$
2
  • \$\begingroup\$ @scotbb that looks much more like I expected. What did you do to the math, I thought only match exchange had LateX support? \$\endgroup\$
    – davolfman
    Commented May 20 at 14:44
  • \$\begingroup\$ We had SE enable MathJax for this site last year. I think ~30? SE sites support MathJax now. Definitely Physics, Mathematics, MathOverflow, and pretty sure Stack Overflow does too. \$\endgroup\$
    – scottbb
    Commented May 22 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.