Mat Template Pointer is NULL
I'm trying to allocate space for a Mat object and access the data via a pointer. I discovered that my pointer was NULL. I'm confused because reserve() should allocate rows yet the ptr is still NULL.
The only thing I've found that works is pushing a value on Mat. Unfortunately that means I've got one extra value in the array. Is there a way I can get a valid pointer without pushing data?
Mat_<int>B;
B.reserve(10); // This should allocate space so I should get a NULL ptr right?
int *pB = B.ptr<int>(0); // here pB = NULL. Arg.
pB = (int *)B.data; // here pB = NULL. Arg.
B.push_back(4);
pB = B.ptr<int>(0); // pB != NULL