Join our book community on Discord
Starting in Chapter 3, Processing Images with OpenCV, our Cameo demo application incorporates 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 the functions directly; instead, for each function, we define a set of control points from which the function is interpolated. In pseudocode, for a BGR image:
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
The type of interpolation may vary between implementations, though it should avoid discontinuous slopes at control...