Contrast vs brightness vs gamma
25 views (last 30 days)
Image Analyst on 13 Dec 2019
Edited: Image Analyst on 13 Dec 2019
Those charts are a mapping of output gray level versus input gray level. A linear 45 degree line means that the output is the same as the input. Changing brightness is like raising or lowering the line so the output is brighter or darker than the input. Changing contrast is changing the slope of the line, which controls the range of the values, so like an input range of 100-120 (very narrow low contrast image) can be mapped to 0-255 (a much wider range and more contrasty image). Changing gamma is related to how much it emphasizes different ranges. If it goes up and flattens out (gamma charts on the left) the dark input range is expanded (making it more visible) while the bright contrast range is compressed. This is good for making dark parts of the image more visible. If the curve curves the other way, it makes the bright parts more visible and compresses the range of the dark parts of the image.
More Answers (1)
DGM on 23 Mar 2022
Regarding visualization, I find that it's helpful to use flat-shaded contour maps to represent the shift in values. At least I find it more intuitive than a set of line plots, given that the contour map is essentially a test image itself.
It's worth noting that different tools implement these adjustments differently. The nature of the parameters is often limited by a need to make them controllable via GUI sliders with finite extents. Consider a basic brightness-contrast-gamma adjustment scheme similar to that described in the question. Herein, brightness and contrast controls have a range of [-1 1], whereas gamma ranges from [0 Inf]. As the contour plots indicate, the null condition occurs when these three parameters are [0 0 1].
Note that brightness is purely additive; unless truncation occurs in a region of interest, local contrast is preserved. On the other hand, contrast changes slope with a midpoint pivot; local contrast is directly altered, but the global mean doesn't shift. Gamma shifts the distribution up or down without moving the endpoints of the curve, meaning black and white don't change.
Again, implementations vary. Consider as an example, the Brightness & Contrast adjustment tool used by GIMP. In this implementation, contrast behaves the same as above, but brightness is a piecewise function:
While this avoids the truncation of image values, it also means that the brightness control is also a contrast control. Raising or lowering brightness reduces both local and global contrast. In my opinion, it makes the tool confusing to use -- but it's an extant convention in a particular context.
Attached is a simple demo that allows the user to explore these behaviors.