What is meant by header of a Mat object in OpenCV?

2.4k Views Asked by At

I am new to C++ programming and OpenCV. I was going through this tutorial on Mat class in OpenCV. It says "each Mat object has its own header" and uses the term header many times. I was not sure what does header mean in this context?

I tried googling and found this page which says: "Mat is basically a class with two data parts: the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored, and so on).........."

Now I understand what does size mean but I have two questions to clarify:

  1. What does "method used for storing" refer to? Which member in the Mat class denotes this?
  2. As for the address, does it correspond to "datastart" member in the Mat class?

Thanks!

1

There are 1 best solutions below

3
On

As per the OpenCV documentation:

Mat is basically a class with two data parts: the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored, and so on) and a pointer to the matrix containing the pixel values (taking any dimensionality depending on the method chosen for storing). The matrix header size is constant, however the size of the matrix itself may vary from image to image and usually is larger by orders of magnitude.