Ask Your Question

Revision history [back]

Split and merge :

Mat x(5,5,CV_32FC3,Scalar(1,2,3));
Mat y=Mat::zeros(5,5,CV_32FC(5));
vector<Mat> xPlan,yPlan;
cout << "x =" << x << "\n";
cout << "y =" << y << "\n";
split(x,xPlan);
split(y,yPlan);
xPlan.push_back(yPlan[3]);
xPlan.push_back(yPlan[4]);
merge(xPlan,y);
cout << "y =" << y << "\n";