Ask Your Question

Revision history [back]

Something like this works

Mat m = imread("f:/lib/opencv/samples/data/lena.jpg", CV_LOAD_IMAGE_COLOR);
Mat logoOriginal = imread("f:/lib/opencv/samples/data/LinuxLogo.jpg",CV_LOAD_IMAGE_COLOR);
resize(logoOriginal,logoOriginal,Size(),0.5,0.5);
imshow("Lena",m);
imshow("Logo",logoOriginal);
waitKey();
Rect r(256-logoOriginal.cols/2,256-logoOriginal.rows/2,logoOriginal.cols,logoOriginal.rows);
logoOriginal.copyTo(m(r)); 
imshow("Lena+logo",m);
waitKey();

Image depth must be same

Something like this works

Mat m = imread("f:/lib/opencv/samples/data/lena.jpg", CV_LOAD_IMAGE_COLOR);
Mat logoOriginal = imread("f:/lib/opencv/samples/data/LinuxLogo.jpg",CV_LOAD_IMAGE_COLOR);
resize(logoOriginal,logoOriginal,Size(),0.5,0.5);
imshow("Lena",m);
imshow("Logo",logoOriginal);
waitKey();
Rect r(256-logoOriginal.cols/2,256-logoOriginal.rows/2,logoOriginal.cols,logoOriginal.rows);
logoOriginal.copyTo(m(r)); 
imshow("Lena+logo",m);
waitKey();

Image depth must be same same.

PS There is tutorial somewhere and many post about this