1 | initial version |
you can try something like that, check the code below:
// I consider that you have two frames, frame1 and frame2 which have similar dimensions
Mat canvas = Mat::zeros(frame1.rows, frame1.cols*2+10, frame1.type());
frame1.copyTo(canvas(Range::all(), Range(0, frame2.cols)));
frame2.copyTo(canvas(Range::all(), Range(frame2.cols+10, frame2.cols*2+10)));
// if it is too big to fit on the screen, then scale it down by 2, hopefully it'll fit :-)
if(canvas.cols > 1920)
{
resize(canvas, canvas, Size(canvas.cols/2, canvas.rows/2));
}
imshow("before and after", canvas);
2 | No.2 Revision |
you can try something like that, check the code below:
// I consider that you have two frames, frame1 and frame2 which have similar dimensions
Mat canvas = Mat::zeros(frame1.rows, frame1.cols*2+10, frame1.type());
frame1.copyTo(canvas(Range::all(), Range(0, frame2.cols)));
frame2.copyTo(canvas(Range::all(), Range(frame2.cols+10, frame2.cols*2+10)));
// if it is too big to fit on the screen, then scale it down by 2, hopefully it'll fit :-)
if(canvas.cols > 1920)
{
resize(canvas, canvas, Size(canvas.cols/2, canvas.rows/2));
}
imshow("before and after", imshow("canvas", canvas);
3 | No.3 Revision |
you can try something like that, check the code below:below (it is in C++ but I do not think that it would be hard to port it in python):
// I consider that you have two frames, frame1 and frame2 which have similar dimensions
Mat canvas = Mat::zeros(frame1.rows, frame1.cols*2+10, frame1.type());
frame1.copyTo(canvas(Range::all(), Range(0, frame2.cols)));
frame2.copyTo(canvas(Range::all(), Range(frame2.cols+10, frame2.cols*2+10)));
// if it is too big to fit on the screen, then scale it down by 2, hopefully it'll fit :-)
if(canvas.cols > 1920)
{
resize(canvas, canvas, Size(canvas.cols/2, canvas.rows/2));
}
imshow("canvas", canvas);