Opencv learning: mat class detailed analysis + source code analysis (1)

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.