Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Since it's not explicitly stated yet, the following is dangerous, since the default Mat constructor does not copy data and a stack reference, wrapped into a Mat object, is returned.

cv::Mat calculateStuff()
{
    int data[] = {1, 2, 3};
    return cv::Mat(1, 3, data, CV_8UC1);
}