All the values in descriptors
will point to the variable row
on the stack with this code.
Looking at the definition of a opencv Mat
, row
returns by value:
// returns a new matrix header for the specified row
Mat row(int y) const;
Accessing the data in _descriptors
directly and stepping with provided stride member variable step
should work however:
Mat _descriptors;
std::vector<int*> descriptors;
for (int i=0; i<_descriptors.rows;i++)
{
descriptors.push_back((int*)(_descriptors.data + i * _descriptors.step));
}