StevenR
StevenR

Reputation: 722

function input variation

I am studying some openCV document and header and try to fully understand what's going on here.

In core_c.h:

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

First, in the declaration of cvInitMatHeader

void* data CV_DEFAULT(NULL),
int step CV_DEFAULT(CV_AUTOSTEP) 

What does this kind of input variable mean? What's the difference between this and the declaration that we usually use, such as

void* data 
int step 

Second, I read tutorial that we actually can use cvInitMatHeader by

double a[] = { 1,  2,  3,  4,
           5,  6,  7,  8,
           9, 10, 11, 12 };
CvMat Ma;
cvInitMatHeader(&Ma, 3, 4, CV_64FC1, a);

the number of input variable is not match with the header, and I cannot find other function overload.

Why is this can work?

Upvotes: 0

Views: 205

Answers (1)

Karolis Juodelė
Karolis Juodelė

Reputation: 3770

From the code given I can deduce that CV_DEFAULT(x) is a macro that expands to = x. See default arguments if you are not familiar with them.

Upvotes: 1

Related Questions