Mixing two images from Opencv

I want to align two images of different sizes with Opencv. Indeed, the cvAddWeighted function allows us to combine or mix two images of the same size, which is not my thing! so I need help if someone knows how to implement this function using given the different sizes of images

thanks ym

+2
source share
3 answers

First , check Adding two images with different sizes .

- , / (cvSetImageROI() ), cvAddWeighted(). .

+5

, , . , .

, . , + , * 2- .

ROI .

+2

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.

0
source

Source: https://habr.com/ru/post/1783647/


All Articles