Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you could just join the images next to each other:

Mat frame;
Mat a = imread("cannyout.png");
Mat b = imread("hay.png");
resize(b,b,a.size());    // both need to be same size & type (you'd never guessed that ..)
Mat iv[2] = {a,b};
hconcat( iv,2,frame );   // there's vconcat, too!
namedWindow("video", 1);
imshow("video", frame);
waitKey();

or do 'picture in picture' (using the ROI operator):

Mat a = imread("cannyout.png");
Mat b = imread("hay.png");
resize(b,b,Size(100,100));       // b will be the 'overlay'
Mat roi = a(Rect(20,20,b.cols,b.rows)); // destination rect
b.copyTo(roi);                   // again, same type/numchannels needed here
namedWindow("video", 1);
imshow("video", a);
waitKey();