Rect_from_Mat, Rect (0, 0, img.rows, img.cols).
:
Rect roi = Rect_from_Mat(img1) & Rect_from_Mat(img2);
Mat img1_roi = img1(roi), img2_roi = img2(roi);
if(results_in_img1)
{
addWeighted(img1_roi, alpha, img2_roi, beta, gamma, img1_roi);
return img1;
}
Note that the string 'addWeighted' will (indirectly) overwrite image data img1.
source
share