Reputation: 1004
I am trying to copy a smaller image at the center of a bigger image. Here is the code:
src.copyTo(dest(Rect(50,50,src.cols,src.rows)));
where both src
and dest
are Mats, dest
is 5 times bigger than src
and assuming 50,50 to be the center of dest.
I am getting the following errors:
no matching function for call to 'cv::Mat::copyTo(cv::Mat)'
Any fixes?
Upvotes: 1
Views: 1390
Reputation: 3858
Try constructing your destination Mat after calling copyTo
:
Mat roi = dest(Rect(50,50,src.cols,src.rows));
src.copyTo(roi);
This should work. copyTo
accepts one OutputArray as a parameter. The proxy classes InputArray and OutputArray are defined as const
references, hence the error. http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=copyto#inputarray
Upvotes: 1