Converting color representations
The earlier recipes taught you how to encapsulate an algorithm into a class. This way, the algorithm becomes easier to use through a simplified interface. Encapsulation also permits you to modify an algorithm's implementation without impacting the classes that use it. This principle is illustrated in this recipe, where we will modify the ColorDetector class algorithm in order to use another color space. Therefore, this recipe will also present an opportunity to introduce color conversions with OpenCV.