标签:each ack col range ret ann ima class mamicode
int main(){ cv::Mat m1=(cv::Mat_<int>(3,2)<<1,2,3,4,5,6); cv::Mat m2=(cv::Mat_<int>(3,2)<<2,4,6,8,10,12); cv::Mat m3=(cv::Mat_<int>(3,2)<<3,6,9,12,15,18); cv::Mat inm[]={m1,m2,m3}; cv::Mat outm; cv::merge(inm,3,outm); // 合并后行数和列数不变。each element of the output array will be a concatenation of the elements of // the input arrays, where elements of i-th input array are treated as mv[i].channels()-element vectors. std::cout<<outm<<std::endl; std::vector<cv::Mat> inm1; inm1.push_back(m1); inm1.push_back(m2); inm1.push_back(m3); cv::Mat outm1; cv::merge(inm1,outm1); std::cout<<outm1<<std::endl; std::cout<<"outm1.rows:"<<outm1.rows<<std::endl; std::cout<<outm1.rowRange(1,3)<<std::endl; std::cout<<"outm1.cols:"<<outm1.cols<<std::endl; std::cout<<outm1.colRange(0,1)<<std::endl; return 0; }
注意:使用merge函数合并后生成的新矩阵行数和列数与输入矩阵的相同。
标签:each ack col range ret ann ima class mamicode
原文地址:https://www.cnblogs.com/ligei/p/11487786.html