How to merge two images in opencv?

前端 未结 4 1439
时光取名叫无心
时光取名叫无心 2020-12-08 07:41

I have calculated homography ,taken out perspective transform .I am able two display two images in one window but unable to merge them.Here are my example images->

4条回答
  •  Happy的楠姐
    2020-12-08 08:33

    You can easily blend two images using the addWeighted() function. But the requirement is that you have to make the images of the same size.

    If the images are not of same size first resize the two images. Then call the following function.

    addWeighted(src1, alpha, src2, beta, 0.0, dst);
    

    Declare the two Mat files

    src1 = imread("c://test//blend1.jpg");
    src2 = imread("c://test//blend2.jpg");
    

    Also declare alpha and beta then save the result to Mat dst.

    You can also get the details here Blending of Images using Opencv

提交回复
热议问题