1 | initial version |
you want copyTo(), not a simple "=" assignment:
Mat cars = imread("cars.jpg");
Mat draw = Mat(cars.size(), cars.type(), Scalar::all(0));
Rect r1(84,81,130,76);
Rect r2(417,144,153,85);
cars(r1).copyTo(draw(r1));
cars(r2).copyTo(draw(r2));
imshow("draw",draw);
waitKey();