Book Image

OpenCV Essentials

Book Image

OpenCV Essentials

Overview of this book

Table of Contents (15 chapters)
OpenCV Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

OpenCV, arguably the most widely used computer vision library, includes hundreds of ready-to-use imaging and vision functions and is extensively used in both academia and industry. As cameras get cheaper and imaging features grow in demand, the range of applications taking advantage of OpenCV is increasing significantly, particularly for mobile platforms.

As a computer vision library, OpenCV provides the following two big advantages:

  • It is open source and everyone can freely use it, either on an academic level or for real-life projects

  • It arguably contains the most extensive and up-to-date collection of computer vision functions

OpenCV is fed with cutting-edge research in Computer Vision, image and video processing, and machine learning.

The first book published on OpenCV provided a mostly theoretical approach, explaining the underlying computer vision techniques. Subsequent books have adopted the contrary approach, filling pages and pages with large examples (almost complete applications) that are difficult to follow. Large examples are difficult to follow and cannot be easily reused in the reader's projects. Examples taking up several pages are simply not appropriate for a book. We believe that examples should be easy to understand and should also be used as building blocks to reduce the time needed to have a working example for the reader's projects. Consequently, in this book, we also adopt a practical approach, although we aim to cover a larger spectrum of functions with shorter, easy-to-follow examples. From our experience with OpenCV, we can affirm that examples are ultimately the most valuable resource.

What this book covers

Chapter 1, Getting Started, deals with the basic installation steps and introduces the essential concepts of the OpenCV API. The first examples to read/write images and video and capture them from a camera are also provided.

Chapter 2, Something We Look At – Graphical User Interfaces, covers user interface capabilities for our OpenCV-based applications.

Chapter 3, First Things First – Image Processing, covers the most useful image processing techniques available in OpenCV.

Chapter 4, What's in the Image? Segmentation, tackles the all-important problem of image segmentation in OpenCV.

Chapter 5, Focusing on the Interesting 2D Features, covers the functions available for extracting keypoints and descriptors from an image.

Chapter 6, Where's Wally? Object Detection, describes that object detection is a central problem in computer vision. This chapter explains the functionality available for object detection.

Chapter 7, What Is He Doing? Motion, considers more than just a single static image. This chapter deals with motion and tracking in OpenCV.

Chapter 8, Advanced Topics, focuses on some advanced topics such as machine learning and GPU-based acceleration.

What you need for this book

The approach followed in this book is particularly suited for readers who are already knowledgeable in computer vision (or can learn the discipline elsewhere) and want to start developing applications rapidly. Each chapter provides several examples of the key available functions for the most important stages in a vision system. The book is, therefore, focused on providing the reader with a working example as soon as possible so that he/she can develop additional features on top of that.

To use this book, only free software is needed. All the examples have been developed and tested with the freely available Qt IDE. The freely available CUDA toolkit is required for the GPU acceleration examples in Chapter 8, Advanced Topics.

Who this book is for

This book is neither a C++ tutorial nor a textbook on computer vision. The book is intended for C++ developers who want to learn how to implement the main techniques of OpenCV and get started with it quickly. Previous contact with computer vision/image processing is expected.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, folder names, filenames, file extensions, pathnames, system variables, URLs, and user input are shown as follows: "Each module has an associated header file (for example, core.hpp)."

A block of code is set as follows:

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{
  Mat frame; // Container for each frame

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{

Any command-line input or output is written as follows:

C:\opencv-buildQt\install

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Also, the checkboxes labeled as Grouped and Advanced should be marked in the CMake main window."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/4244OS_Graphics.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.