opencv std::vector<cv:Mat>

Mat is some kind of smart pointer for the pixels

Mat a=b will have shared pixels for a and b. similar situation for push_back()

if you need a 'deep copy', use Mat::clone()

所以在初始化含Mat的容器时要用以下代码:

vector<cv::Mat> fims;
for (int numMat = 0; numMat < 6; numMat++) {
cv::Mat fim(m_hSample, m_wSample, CV_32FC3);
fims.push_back(fim);
}

posted @ 2019-04-25 15:42  Emma00  阅读(4111)  评论(0编辑  收藏  举报