1 | initial version |
Another solution is to use hconcat
and vconcat
.
Demo code:
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
using namespace cv;
int main() {
Mat img11(240, 320, CV_8UC3, Scalar(0,0,255));
Mat img12(240, 320, CV_8UC3, Scalar(0,255,0));
Mat img21(240, 320, CV_8UC3, Scalar(255,0,0));
Mat img22(240, 320, CV_8UC3, Scalar(255,0,255));
Mat concat1;
hconcat(img11, img12, concat1);
Mat concat2;
hconcat(img21, img22, concat2);
Mat concat;
vconcat(concat1, concat2, concat);
imshow("Concat", concat);
waitKey();
return 0;
}
2 | No.2 Revision |
Another solution is to use hconcat
and vconcat
.. Will work for trivial dimensions.
Demo code:
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
using namespace cv;
int main() {
Mat img11(240, 320, CV_8UC3, Scalar(0,0,255));
Mat img12(240, 320, CV_8UC3, Scalar(0,255,0));
Mat img21(240, 320, CV_8UC3, Scalar(255,0,0));
Mat img22(240, 320, CV_8UC3, Scalar(255,0,255));
Mat concat1;
hconcat(img11, img12, concat1);
Mat concat2;
hconcat(img21, img22, concat2);
Mat concat;
vconcat(concat1, concat2, concat);
imshow("Concat", concat);
waitKey();
return 0;
}