Menu

Gamma Correction

Attention conservation notice: This note is just a few calculations about gamma correction and some scrappy Python code in case I need it later. You'd be better served reading the Wikipedia page and looking at the cool images.

A collegue, Nick Cheng, likes to adjust grades using gamma correction. This curving process is usually used to brighten up images but it can also help “brighten up” grades. The idea is to replace a grade $x$ with $x^\gamma$ for some value of $\gamma$. If $0 < \gamma \leq 1$ then all the grades go up: the lower grades get increased more and the higher grades get increased less1.

In 2024, Nick asked a calculus question about this curve: Which grade $x$ gets boosted the most2? Recently, I got wondering about gamma correction again. I wanted to get a sense of the various different values of gammas and the corresponding gamma corrections work. And so, I wrote the scrappy Python program below and calculated some values.

Staring it the values, a few thoughts come to mind:

The $\gamma=0.5$ Distribution #

Count Percentage Gamma
0 0.00 0.00
1 0.10 0.32
2 0.20 0.45
3 0.30 0.55
4 0.40 0.63
5 0.50 0.71
6 0.60 0.77
7 0.70 0.84
8 0.80 0.89
9 0.90 0.95
10 1.00 1.00

The $\gamma=0.7$ Distribution #

Count Percentage Gamma
0 0.00 0.00
1 0.10 0.20
2 0.20 0.32
3 0.30 0.43
4 0.40 0.53
5 0.50 0.62
6 0.60 0.70
7 0.70 0.78
8 0.80 0.86
9 0.90 0.93
10 1.00 1.00

The $\gamma=0.8$ Distribution #

Count Percentage Gamma
0 0.00 0.00
1 0.10 0.16
2 0.20 0.28
3 0.30 0.38
4 0.40 0.48
5 0.50 0.57
6 0.60 0.66
7 0.70 0.75
8 0.80 0.84
9 0.90 0.92

The Python #

 #!/bin/python3
 
 import math;
 
 N = 10;
 
 gammaList=[0.5, 0.7, 0.8];
 
 for g in gammaList:
     print("# The $\\gamma={}$ Distribution \n".format(g));
     print("| Count | Percentage | Gamma |")
     print("|-------|------------|-------|")
 
     for i in range(0, N+1):
         print("| {} | {:.2f} | {:.2f} |".format(i,i/N,(i/N)**g));
 
     print("\n")

  1. We leave it as exercise to the reader taking Calculus 1 to formalize and check these statements about $x \mapsto x^\gamma$. ↩︎

  2. Another nice exercise. ↩︎


Published: Apr 14, 2026 @ 21:05.
Last Modified: Apr 15, 2026 @ 22:25.

Tags

#career #math #teaching

Backlinks

Navigation Menu

Home / Now / Blog / Notes / Reading / Office Camera / Bookmarks / Tags / Archive / RSS Feeds / Top of Page

Thanks for reading! If you have any comments or questions about the content, please let me know. Anyone can contact me by email.