John Smith
John Smith

Reputation: 1089

Gamma correction formula

In discussion of gamma correction, most people write formula

y = 255 (x/255)^gamma

I guess this is applied for each channel: R, G and B. My quesion is following

  1. shouldn't I rather analyze the image (I assume 8bit per color channel), find the maximum intensity pixel among all channels and then write

    y = x_max (x/x_max)^gamma

?

  1. if the answer for part 1. is "yes" then the second question follows: what should I use for x_max for each color channel? should I find a single value x_max for all colors or should I use individual x_max for each color channel, x_max_r, x_max_g and x_max_b?

Upvotes: 1

Views: 2127

Answers (1)

Adi Shavit
Adi Shavit

Reputation: 17265

The answer is, generally, no: you should not normalize by the (content dependent) max grayscale value.
The gamma correction is exponential (thus, scale sensitive) and is done on the scale of [0,1].
In the case of 8-bit images, the max (possible) value is 255, so you normalize by 255 to scale the value range to [0,1].

Upvotes: 2

Related Questions