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); // I tried this but I still got NULL
int *pB = B.ptr<int>(0); // pB = NULL
pB = (int *)B.data;
B.push_back(4);
pB = B.ptr<int>(0); // pB != NULL