简体   繁体   English

如何在OpenCV C ++中合并(缝合)2个没有黑点的图像

[英]how to merge (stitch) 2 images without black points in opencv c++

I have 2 images and when I stitch them, there'll be some black area in the resulting image. 我有2张图像,当我缝合它们时,结果图像中会有一些黑色区域。 I'll share the images. 我将分享图像。 so how can I stitch them without the black area? 那么如何在没有黑色区域的情况下缝制它们?

I have a homography matrix and I stitch them using ROI. 我有一个单应矩阵,并使用ROI对其进行缝合。

But I have a search about "seamless clone" in OpenCV, but I don't yet know it'll help me. 但是我在OpenCV中搜索了“无缝克隆”,但是我还不知道它将对我有帮助。 I need advice. 我需要建议。

I want like that: enter image description here 我想要这样: 在此处输入图片描述

https://www.harrisgeospatial.com/docs/html/images/Mosaic/DiagramUpdateFootprints.png https://www.harrisgeospatial.com/docs/html/images/Mosaic/DiagramUpdateFootprints.png

If you dont need a blending: 如果您不需要混合:

pseudo code: 伪代码:

inputs: image A, image B, backgroundColorRange X
outputs: image O

for each pixel in the output image:
    if(pixel(A) == X AND pixel(B) == X) pixel(O) = X;
    else if (pixel(A != X) AND pixel(B == X) pixel(O) = pixel(A);
    else if (pixel(A == X) AND pixel(B == X) pixel(O) = pixel(B);
    else if (pixel(A != X) AND pixel(B != X) pixel(O) = 0.5*pixel(A) + 0.5*pixel(B)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM