您好,我有不同的图像采取使用曝光括号(同一场景不同的曝光),我需要对齐的图像,并裁剪每一个,以使他们能够完全匹配。(因为拍摄这些图像时相机会抖动)
我不想合并它们,我只想剪切、旋转或缩放…等等,使它们精确对齐,然后保存它们。如果我知道如何做到这一点,我会添加一个代码示例。但我不知道。我是opencv的新手
下面是一个例子:
这是一个样本的真实例子:(这个样本有一个巨大的偏差,大多数样本只需要小的调整,因为与这个样本不同的是震动)
我需要的是裁剪每个图像,使它们完全相同(只保留共享区域)
谢谢大家!
Tags:
在这个回答中,我描述了一种实现图像对齐的方法,该方法包括使用欧几里德模型根据中心图像图像2变换图像1(左侧)和图像3(右侧)
但是,我想很快指出,共享的图像非常具有挑战性:不仅对比度有很大差异,而且它们在平移、缩放、旋转,甚至可能有一点剪切方面也有显著差异。事实上,他们被张贴为非常低的分辨率也没有帮助
无论如何,我指出了它们在2D变换方面的差异,因为在选择适当的模型执行图像对齐时,您需要始终牢记这一点This nice picture is from a tutorial that describes the models in greater detail:
该方法包括以下步骤:
cv2.warpAffine()
变换图像1,并计算图像1中变换的近似矩形面积李>cv2.warpAffine()
的帮助下变换图像3,并计算变换的近似矩形面积李>中间图像中的红色矩形(用于创建变换模型的参考图像)是图像1和3上区域之间的交点,可以视为所有3个图像之间的公共区域
然后可以使用红色矩形裁剪图像1、2和3,并提供图像对齐的良好外观。请注意,所有这些图像上的地形和天空看起来是如何完美地相互对齐的:
有趣的是,注意到这种方法的成本:因为图像1没有捕获图像2和3上可以很容易看到的所有地形特征,最终的结果是图像2和3最终失去了该部分地形。因此,所有图像显示的都是照片中完全相同的区域
Python源代码:
相关问题 更多 >
编程相关推荐