Since we cache a lookup array for each curve, our curve-based filters have data associated with them. Thus, we will implement them as classes, not just functions. Let's make a pair of curve filter classes, along with some corresponding higher-level classes that can apply any function, not just a curve function:
- VFuncFilter: This is a class that is instantiated with a function, which it can then apply to an image using apply. The function is applied to the V (value) channel of a grayscale image or to all the channels of a color image.
- VCurveFilter: This is a subclass of VFuncFilter. Instead of being instantiated with a function, it is instantiated with a set of control points, which it uses internally to create a curve function.
- BGRFuncFilter: This is a class that is instantiated with up to four functions, which it can then apply to...