Book Image

Learn OpenCV 4 By Building Projects - Second Edition

By : David Millán Escrivá, Vinícius G. Mendonça, Prateek Joshi
Book Image

Learn OpenCV 4 By Building Projects - Second Edition

By: David Millán Escrivá, Vinícius G. Mendonça, Prateek Joshi

Overview of this book

OpenCV is one of the best open source libraries available, and can help you focus on constructing complete projects on image processing, motion detection, and image segmentation. Whether you’re completely new to computer vision, or have a basic understanding of its concepts, Learn OpenCV 4 by Building Projects – Second edition will be your guide to understanding OpenCV concepts and algorithms through real-world examples and projects. You’ll begin with the installation of OpenCV and the basics of image processing. Then, you’ll cover user interfaces and get deeper into image processing. As you progress through the book, you'll learn complex computer vision algorithms and explore machine learning and face detection. The book then guides you in creating optical flow video analysis and background subtraction in complex scenes. In the concluding chapters, you'll also learn about text segmentation and recognition and understand the basics of the new and improved deep learning module. By the end of this book, you'll be familiar with the basics of Open CV, such as matrix operations, filters, and histograms, and you'll have mastered commonly used computer vision techniques to build OpenCV projects from scratch.
Table of Contents (14 chapters)

The Mixture of Gaussians approach

Before we talk about Mixture of Gaussians (MOG), let's see what a mixture model is. A mixture model is just a statistical model that can be used to represent the presence of subpopulations within our data. We don't really care about what category each data point belongs to. All we need to do is identify that the data has multiple groups inside it. If we represent each subpopulation using the Gaussian function, then it's called Mixture of Gaussians. Let's consider the following photograph:

Now, as we gather more frames in this scene, every part of the image will gradually become a part of the background model. This is what we discussed earlier in the Frame differencing section as well. If a scene is static, the model adapts itself to make sure the background model is updated. The foreground mask, which is supposed to represent...