Ask Your Question

Revision history [back]

Why doesn't cvInitMatHeader return void?

I'm reading through an OpenCV tutorial and see this description of cvInitMatHeader:

Initialize header on existing CvMat structure

The signature of this method is shown as follows:

CvMat* cvInitMatHeader(
   CvMat* mat,
   int rows,
   int cols,
   int type,
   void* data = NULL,
   int step = CV_AUTOSTEP);

Double-checking oni=line, this seems accurate. What puzzles me is if the point of this method is to initialize the header on an existing cvMat (presumably, the first argument), why does it return a pointer to cvMat?

Is this another pointer to mat (i.e. the first argument)? If not, what is its relation to mat, which I would think is the existing cvMat structure whose header is being initialized?