Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

no, please don't use new with cv::Mat, or raw pointers at all. (they stopped doing so in c++ in the 90's)

cv::Mat is already a smartpointer around the pixels, so passing around pointers to that will for sure wreck the internal refounts, sooner or later

instead, please use a std::vector , like this:

vector<Mat> imgs(5); // allocate 5 (empty) Mats
for (int i=0; i<5; i++)  // load 5 images
    imgs=imread(format("my_%d.jpg", i));

no, please don't use new with cv::Mat, or raw pointers at all. (they stopped doing so in c++ in the 90's)

cv::Mat is already a smartpointer around the pixels, so passing around pointers to that will for sure wreck the internal refounts, sooner or later

instead, please use a std::vector , like this:

vector<Mat> imgs(5); // allocate 5 (empty) Mats
for (int i=0; i<5; i++)  // load 5 images
    imgs=imread(format("my_%d.jpg", i));

// no need to release() the mat's, this will be done automatically

no, please don't use new with cv::Mat, or raw pointers at all. (they stopped doing so in c++ in the 90's)all.

cv::Mat is already a smartpointer around the pixels, so passing around pointers to that will for sure wreck the internal refounts, sooner or later

instead, please use a std::vector , like this:

vector<Mat> imgs(5); // allocate 5 (empty) Mats
for (int i=0; i<5; i++)  // load 5 images
    imgs=imread(format("my_%d.jpg", i));

// no need to release() the mat's, this will be done automatically

no, please don't use new with cv::Mat, or raw pointers at all.

cv::Mat is already a smartpointer around the pixels, so passing around pointers to that will for sure wreck the internal refounts, sooner or later

instead, please use a std::vector , like this:

vector<Mat> imgs(5); // allocate 5 (empty) Mats
for (int i=0; i<5; i++)  // load 5 images
    imgs=imread(format("my_%d.jpg", imgs[i] = imread(format("my_%d.jpg", i));

// no need to release() the mat's, this will be done automatically

no, please don't use new with cv::Mat, or raw pointers at all.

cv::Mat is already a smartpointer around the pixels, so passing around pointers to that will for sure wreck the internal refounts, refcounts, sooner or later

instead, please use a std::vector , like this:

vector<Mat> imgs(5); // allocate 5 (empty) Mats
for (int i=0; i<5; i++)  // load 5 images
    imgs[i] = imread(format("my_%d.jpg", i));

// no need to release() the mat's, this will be done automatically