Book Image

OpenCV 2 Computer Vision Application Programming Cookbook

By : Robert Laganiere
Book Image

OpenCV 2 Computer Vision Application Programming Cookbook

By: Robert Laganiere

Overview of this book

<p>In today's digital world, images are everywhere, and with the advent of powerful and affordable computing devices, it has become possible to create sophisticated applications manipulating images and videos. Adding special effects, enhancing image features, performing object recognition, and reconstructing 3D information are tasks that can be programmed easily with the OpenCV library, which is a widely used open source library that offers a rich set of advanced computer vision algorithms.</p> <p><em>OpenCV 2 Computer Vision Application Programming Cookbook</em> will introduce you to numerous computer vision algorithms included in the OpenCV library. You will learn how to read, write, create and manipulate images. You will explore different techniques commonly used in image analysis and how they can be effectively implemented in C++. The book provides a complete introduction to the OpenCV library and explains how to build your first computer vision program. You will be presented with a variety of computer vision algorithms and be exposed to important concepts in image analysis that will enable you to build your own computer vision applications.</p> <p>The book helps you to get started with the library, showing you how to install and deploy the OpenCV library to write effective computer vision applications following good programming practices. The techniques to process an image and its pixels using the data structures offered by the library are explained in detail. You will learn how to build and manipulate an image histogram; how to detect lines and contours. You will be introduced to the concept of mathematical morphology and image filtering. The detection and use of interest points in computer vision is presented with applications for image matching and object recognition. Techniques to achieve camera calibration and 3D reconstruction are presented.</p> <p><em>OpenCV 2 Computer Vision Application Programming Cookbook</em> is your guide to the development of computer vision applications. It is a comprehensive reference that exposes you to computer vision concepts illustrated with extensive examples.</p>
Table of Contents (17 chapters)
OpenCV 2 Computer Vision Application Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 gamut of different colors. In fact, the human visual system is also based on a trichromatic perception of colors with cone cell sensitivity located around the red, green, and blue spectrum. It is often the default color space in digital imagery because...