Curve adjustment 2015-04-03

Curve adjustment transforms the input shade to a new output shade as specified by the curve. For example the invert curve inverts the shade of each colour by applying the operation output = 256 - input therefore inverting the values.

Curve adjustment is more powerful than many of the other transformation techniques as each channel can have an individual curve and each curve can consist of many control points. For example the preset warmer curves splits the red and blue channels, whilst leaving green unchanged. The red shades are transformed to be more brighter and the blue darker warming the image.

Other common curves include increasing (and descreasing) the contrast. These curves work by transforming shades away (and towards) the midpoint shade, 128 by adding control points above and below the linear line. To increase contrast input shades below the midpoint should be transformed further from the midpoint, hence a control point is added below the linear line, the opposite is true for input shades above the midpoint. Higher constrast enchancement can be achieved by moving the control points further from the linear line in both directions.

The curve transformation is coded as below assuming the _curve functions return the output shade given the input shade. (See the stet image representation if this isn't clear).

  
for(var byte in image)
{
  image[byte] = red_curve(image[byte]);
  image[byte + 1] = blue_curve(image[byte + 1]);
  image[byte + 2] = green_curve(image[byte + 2]);
}
  
Back to blog