Array and Matrix Operations

Now that we're past the first part of the book and the introductions and fundamental concepts in computer vision, we can start with the computer vision algorithms and functions provided by the OpenCV library, which more or less cover any computer vision topic that comes to mind, with optimized implementations. As we learned in the previous chapters, OpenCV uses a modular structure to categorize the computer vision functionalities contained in it. We'll move forward with the topics in this book with a similar structure in mind, so that the skills learned are related to each other in each chapter, not just from a theoretical point of view, but also from a hands-on perspective.

In the previous chapter, we learned about the relationship between images and matrices, and covered the most crucial functionalities of the Mat class, such as constructing it using a given width, height, and type. We also learned how to read images from disk, a network feed, video files, or cameras. During the process, we learned how to access pixels in an image using various methods. We can now start with actual image- and pixel-modification and manipulation functionalities.

In this chapter, we're going to learn about a large number of functions and algorithms that are used to deal with images, either for calculating a value that might be useful in another process or for directly modifying the values of the pixels in an image. Almost all of the algorithms presented in this chapter are based on the fact that images are essentially matrices, and also the fact that matrices are implemented using arrays of data, hence the name of this chapter!

We'll start this chapter by covering the functionalities within the Mat class itself, which are few, but quite important when it comes to the creation of initial matrices and so on. Then, we'll move on to learn about a large number of per-element (or element-wise) algorithms. These algorithms, as we'll learn by going through many hands-on examples, apply a specific operation on each individual element of a matrix and they are not concerned with any other element (or pixel). Finally, we'll learn about matrix and array operations that are not element-wise and the result may depend on the whole image or groups of elements. This will all clear up as we move forward with the algorithms in this chapter. It's important to note that all of the algorithms and functions in this chapter are contained within the core module of OpenCV library.

By the end of this chapter, you'll have a better understanding of the following:

  • Operations contained in the Mat class
  • Element-wise matrix operations
  • Matrix and array-wise operations
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.79.65