O'Reilly logo

OpenCV 2 Computer Vision Application Programming Cookbook by Robert Laganière

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Converting color spaces

This chapter 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 be an opportunity to introduce color conversion with OpenCV.

Getting ready

The RGB color space (or BGR depending on which order the colors are stored) is based on the use of the red, green, and blue additive primary colors. These have been selected because when they are combined they can produce a wide ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required