The mat class is a basic data structure and belongs to the C ++ series functions (classes) in opencv. Finding out the context of the mat is helpful for subsequent image processing, next, let's talk about the mat class.
Mat class declaration path in opencv: opencv-2.4.5/modules/CORE/include/opencv2/CORE. HPP
Mat class implementation path in opencv: opencv-2.4.5/modules/CORE/include/opencv2/CORE/mat. HPP
Opencv-2.4.5/modules/CORE/src/matrix. cpp
The mat class declaration is as follows:
Class cv_exports mat {// The Mat class has many member functions. To clarify the mat structure, only important data members of the mat class are listed here, analyze other data members and function members later ...... public: int flags; // The flag bit, such as the int dims with several bands; // The Int rows and Cols of the matrix dimension; // The number of rows and columns of the matrix uchar * data; // pointer to data, key point! Note that the pointer to the data is unsigned char. Int * refcount; // point to the reference counter (the famous reference counter in C ++ )......};
Now, the basic data structure of mat is as shown above. Next we will start with the member functions of mat to unveil the secrets of the basic data structure of Mat opencv.
These functions cannot be explained from top to bottom. They should always be logical. We divide these functions as follows:
(1) constructor and destructor
(2) matrix element locating functions: At and PTR Functions
(3) size and step of important data members in mat