#include #include #include #include using namespace cv; int main(){ Mat img(400, 600, CV_8UC3); img.setTo(Scalar(0,0,255)); Rect r(0,0,600, 200); img(r).setTo(Scalar(0,255,255)); //imshow("img", img); Mat kurama = imread("kurama.jpg", IMREAD_COLOR); /*int pad = 50; Rect r2(pad, pad, kurama.cols - 2 * pad, kurama.rows - 2 * pad); Mat small = kurama(r2); imwrite("small_kurama.png", small);*/ //cutting 50px off the pic resize(kurama, kurama, Size(200, 200)); Rect r3(img.cols/2-100, img.rows/2-100, kurama.cols, kurama.rows); kurama.copyTo(img(r3)); //copy kurama image over the yellow and red rects imshow("img2", img); waitKey(); return 0; }