Starting in Chapter 3, Processing Images with OpenCV, our Cameo demo application incorporated an image processing effect called curves, which it uses to emulate the color bias of certain photo films. This Appendix describes the concept of curves and their implementation using SciPy.
Curves are a technique for remapping colors. With curves, a channel's value at a destination pixel is a function of (only) the same channel's value at the source pixel. Moreover, we do not define functions directly; instead, for each function, we define a set of control points that the function must fit by means of interpolation. In pseudocode, for a BGR image, we have the following:
dst.b = funcB(src.b) where funcB interpolates pointsB
dst.g = funcG(src.g) where funcG interpolates pointsG
dst.r = funcR(src.r) where funcR interpolates pointsR...