Now, it's time to introduce OpenCV, or Open Source Computer Vision library, or framework if you will, since itself uses them interchangeably and that may also happen throughout this book. However, for the most part we'll simply stick to OpenCV. Well, let's first hear what it really is and then break it down where needed.
OpenCV is an open source and cross-platform library that is used to develop computer vision applications. With a focus on speed and performance, it includes hundreds of algorithms within a variety of modules. These modules are also categorized into two types: the Main
and Extra
modules. Main OpenCV modules are simply all modules that are built and maintained within OpenCV community, and they are a part of the default package provided by OpenCV.
This is in contrast to the Extra modules of OpenCV, which are more or less wrappers for third-party libraries and interfaces required to integrate them into an OpenCV build. The following are some examples of different module types with a brief description for each. It is worth noting that the number of (and sometimes even the order of) modules within OpenCV can be changed over time, so the best thing to keep in mind about this is to just pay a visit to the OpenCV documentation pages whenever something seems to be out of place, or if something is not where it used to be.
Here are some examples of OpenCV main modules. Note that they're just a few (and probably the most widely used) of modules within OpenCV, and covering all of them is out of the scope of this book, but it makes sense to have an idea of what OpenCV contains, just like what we saw Qt earlier in this chapter. Here they are:
- Core functionality or simply
core
module contains all basic structures, constants, and functions used by all other OpenCV modules. For instance, the infamous OpenCVMat
class, which we'll use almost in every OpenCV example for the rest of the book, is defined in this module. Chapter 4, Mat and QImage, will cover this and closely-related OpenCV modules along with corresponding parts of the Qt framework. - Image processing or
imgproc
module contains many different algorithms for image filtering, image transformation, and as the name implies, it's used for general image processing use. We'll be introduced to this module and its functions in Chapter 6, Image Processing in OpenCV. - The 2D Features Framework module or
features2d
includes classes and methods used for feature extraction and matching. They'll be covered in more detail in Chapter 7, Features and Descriptors. - The video module contains algorithms that are used for topics such as motion estimation, background subtraction, and tracking. This module, along with other similar modules of OpenCV, will be covered in Chapter 9, Video Analysis.
As it was mentioned before, Extra modules are mostly wrappers for third-party libraries, that means they only contain interfaces or methods needed to integrate those modules. An example Extra module would be the text
module. This module contains interfaces to use Text in images or OCR (Optical Character Recognition), and you'll also need those third-party modules for this work, and they are not covered as a part of this book, but you can always check the OpenCV documentation for an list of Extra modules how they are used.
For more on this you can refer to http://docs.opencv.org/master/index.html.
Note
Platforms Supported by OpenCV: As it was mentioned before, Platform is not just the operating system in case of application development. So, we need to know which operating systems, processor architectures, and the compiler is supported by OpenCV. OpenCV is highly cross-platform, and, almost like Qt, you can develop OpenCV applications for all major operating systems, including Windows, Linux, macOS, Android, and iOS. As we'll see later on, we'll use the MSVC 2015 (32-bit) compiler on Windows, GCC on Linux, and Clang on macOS. It's also important to note that we'll need to build OpenCV using its source code by ourselves since at the moment, prebuilt binaries are not provided for the mentioned compilers. However, as you'll see later on, OpenCV is fairly easy to build for any operating system if you have the right tools and instructions.