All about the Mat class
In the previous chapters, you experienced using the Mat
class of the OpenCV framework very briefly, but we're going to dig a little bit deeper now. The Mat
class, which borrows its name from the matrix, is an n-dimensional array capable of storing and handling different mathematical data types in single or multiple channels. To simplify this further, let's take a look at what an image is in terms of computer vision. An in computer vision is a matrix (therefore a two-dimensional array) of pixels, with a specified width (number of columns in the matrix) and height (number of rows in the matrix). Furthermore, a pixel in a grayscale image can be represented with a single number (therefore a single channel), with a minimum value (usually 0) representing the black and a maximum value (usually 255, which is the highest number possible with one byte) representing the white, and all values in between corresponding to different gray intensities accordingly. Look at the following...