Top Banner
图像拼接算法研究 演讲人:江琳 吴艳娜 指导教师:回玒 学院:信息安全工程学院
61

Image Stitching Method

Jul 05, 2015

Download

Technology

wuyanna

Study on the image stitching approach and execute comparative experiments on a variety of image recognition and stitching algorithm. Implement a photo stitching program using the SIFT algorithm with MATLAB.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Image Stitching Method

图像拼接算法研究

演讲人:江琳 吴艳娜 指导教师:回玒 学院:信息安全工程学院

!

Page 2: Image Stitching Method

图像拼接简

介!

• 图像拼接的应用!• 技术简介!

图像配准!

• 柱面投影!• 特征点提取和描述算法介绍!• 匹配算法!• 总结!

图像融合!

• 图像坐标变换模型!• 图像插值!• 边界过渡与光照调整!

演示!

Page 3: Image Stitching Method

应⽤用

Page 4: Image Stitching Method
Page 5: Image Stitching Method

图像配准技术

Page 6: Image Stitching Method

前提与假设

"   拍摄图像的摄像机中心固定。摄像机除了绕纵轴水平方向旋转外,没有其他旋转或平移。

"   所拼接图像有一定的重合区域。

Page 7: Image Stitching Method

图像配准

"   柱面投影

"   特征点提取和描述算法介绍

"   特征点匹配

"   方案比较

"   小结

Page 8: Image Stitching Method

柱⾯面投影

"   符合以上条件的图像,必须经过预处理,才能进行特征点的提取和匹配。否则会出现图像的一端放大失真的现

象。

"   为解决这个问题,我们将图片投影在一个柱面上。

Page 9: Image Stitching Method
Page 10: Image Stitching Method

柱⾯面投影

投影公式如下:!

2 2

2' ( ) ( )2

( )2'

2( )

2

Cc Cc f arctn f arctgf fRf r Rr

Cc f

⎧ −⎪= ⋅ + ⋅⎪

⎪⎪⎨ −⎪

= +⎪⎪ − +⎪⎩

Page 11: Image Stitching Method

柱⾯面投影

Page 12: Image Stitching Method

图像配准

"   柱面投影

"   特征点提取和描述算法介绍

"   特征点匹配

"   方案比较

"   小结

Page 13: Image Stitching Method

"   要匹配两幅图像的特征点,有以下步骤:

提取 描述 匹配

Page 14: Image Stitching Method

Harris算法提取⾓角点

2

2

I I Ix x y

H LI I Iy x y

⎡ ⎤⎛ ⎞∂ ∂ ∂⎛ ⎞ ⎛ ⎞⎢ ⎥⎜ ⎟⎜ ⎟ ⎜ ⎟∂ ∂ ∂⎝ ⎠ ⎝ ⎠⎝ ⎠⎢ ⎥= ∗⎢ ⎥⎛ ⎞ ⎛ ⎞∂ ∂ ∂⎛ ⎞⎢ ⎥⎜ ⎟ ⎜ ⎟⎜ ⎟⎢ ⎥∂ ∂ ∂⎝ ⎠⎝ ⎠ ⎝ ⎠⎣ ⎦

I(x,y) ------------点(x,y)处的灰度值 ∂I/∂x  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐图像在x方向的一阶导数  ∂I/∂y-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐图像在y方向的一阶导数  L ----------------线性低通高斯模板 det(H)-----------矩阵H的行列式 trace(H)--------矩阵H的迹 k-------------------阈值系数!

R  =  det(H)  -­‐  k(trace(H))  2  !

Page 15: Image Stitching Method

Harris算法提取⾓角点

Page 16: Image Stitching Method

描述特征点——Hu不变矩

"   选择以特征点为中心半径为r的圆形区域  

"   分别计算该区域的红,绿,蓝三种分量的七维Hu不变矩,  

"   将这三个Hu矩合并为一个21维的特征向量;    

Page 17: Image Stitching Method

特征点提取和描述——SIFT算法

"   构造高斯金字塔和高斯差分金字塔!

Page 18: Image Stitching Method

特征点提取和描述——SIFT算法

检测极值点 筛选极值点 提取稳定

的极值点

在高斯差分金字塔分层结构中,样本像素点需

要和它相邻的8个像素点以及上下相邻图像层中的各9个像素点共26个点进行比较。 如果样本像素点是27个点中最大或最小的,则视为极值点。!

提取出图像中的极值点作为候选特征点,并在

这些特征点中筛选掉低对比度和处于边缘的特

征点。!

Page 19: Image Stitching Method

特征点提取和描述——SIFT算法

关键点!

Page 20: Image Stitching Method

特征点提取和描述——SIFT算法

关键点!

Page 21: Image Stitching Method

特征点提取和描述⽅方案

"   由以上3中算法,我们得到两种方案:

"   1. Harris算法提取特征点,Hu不变矩描述特征点,得到21维特征向量。

"   2. SIFT算法提取和描述特征点,得到128维特征向量。

Page 22: Image Stitching Method

图像配准

"   柱面投影

"   特征点提取和描述算法介绍

"   特征点匹配

"   方案比较

"   小结

Page 23: Image Stitching Method

特征点匹配

"   假设其特征向量为Vl(i),通过下式所表示两特征向量各维的相对距离之和作为这两个特征点的相似性度量S:

"   S越小,相似度越高。!

21

1

( ) ( )( ) ( )i

Vl i Vr iS

Vl i Vr i ε=

−=

+ +∑

Page 24: Image Stitching Method

特征点匹配

"   1. 图1中的特征点p1(i)与图2中的所有特征点计算S,找出图2中的p2(j)、p2(k),使得S最小和次小。若S(ij) < T*S(ik),则认为p2(j)是p1(i)的匹配点,其中T为一阈值。

"   2. 反过来,在图1中找p2(j)的匹配点,若也是p1(i),则认为p1(i)和p2(j)匹配。!

Page 25: Image Stitching Method

图像配准

"   柱面投影

"   特征点提取和描述算法介绍

"   特征点匹配

"   方案比较

"   小结

Page 26: Image Stitching Method

⽅方案⽐比较

"   我们对两套方案的时间开销在matlab上进行了比较,一定程度上可以说明这两种算法的运算复杂度。!

Page 27: Image Stitching Method

⽅方案⽐比较结果

方案一! 方案二!

提取特征点用时! 3.327s(harris)!

特征点数! 159! 1600!

生成特征矩阵耗时! 0.288s! 6.167s(包括提取特征点)!

匹配耗时! 0.044s! 3.846s!

匹配点对数! 30! 219!

Page 28: Image Stitching Method

匹配⽅方案——⽐比较结果

"   方案二比方案一提取的特征点多,前者约为后者的10倍。同时得到的匹配点对数也多。

"   匹配点多可以使得匹配更加精确,但也是运算速度大大减慢。

"   根据这两个方案的特点,我们得出以下结论: "   对于尺度大小相当、相似度较高的图像拼接,可应用方案一;

"   对于尺度大小相差较大、相似度较低的图像,可应用方案二。!

Page 29: Image Stitching Method

利⽤用空间⽅方向约束剔除误差匹配

"   对于摄像机绕其中心在某一平面旋转而不发生绕主轴旋转而拍摄的两幅图像,当两幅图在有重叠部分的一端排

在一起时,正确匹配点之间线段的倾斜角和长度都极为

相近;

"   在获得初始匹配集后可以利用倾斜角和距离去除误匹配点;

Page 30: Image Stitching Method
Page 31: Image Stitching Method

图像配准

"   柱面投影

"   特征点提取和描述算法介绍

"   特征点匹配

"   方案比较

"   小结

Page 32: Image Stitching Method

"   图像配准一般还有RANSAC提取最大内点集、引导匹配等过程。但考虑到本课题所针对的图像特点,不再采取

这几个方法。程序中这些方法的函数已写出,供以后进

一步改进算法。

"   至此,图像配准过程结束。得到的返回值为连接线水平长度的平均值,供图像融合使用。!

Page 33: Image Stitching Method

图像融合⽅方法

Page 34: Image Stitching Method

图像融合⽅方法

图像坐标

变换模型 图像的插

值 过渡与光

照调整 成果展示

三种常见变换

8-参数

前向映射与逆

向映射

最邻近点插值

双线性插值法

线性加权方法

光照调整局限

Page 35: Image Stitching Method

图像坐标变换模型

"   如果对同一个物体在不同的方向进行拍摄,获得两幅图片,其中一幅图像可以通过对应的二维映射变换得到另

一幅图 " 一般的投影变换形式 " 基本变换有刚性变换,仿射变换及投影变换!

Page 36: Image Stitching Method

⼀一般投影变换形式

X’=MX其中X’和X是两幅图像中的同一景物,M矩阵为投影变换矩阵。

Page 37: Image Stitching Method

常⻅见的三种图像变换模型

Page 38: Image Stitching Method

8-参数模型

"   给定了从同一个观察点但是不同方向上拍摄的两幅图像,则两幅重叠图像的关系可以通过一个平面的投影运动模

型描述。 "   平面投影变换通过下面公式把一幅图像变换成了另一幅:

Page 39: Image Stitching Method

"   解出上式中的8个系数,就确定了两幅图像之间的投影关系,从而完成具有相同场景的两幅图像之间的转换!

通过齐次变换得到方程:!

Page 40: Image Stitching Method
Page 41: Image Stitching Method

"   由于图像的像素点坐标都是整数表示,而映射后的像素的坐标不能保证是整数,若进行简单取舍,则图像中会

出项明显“空洞”和“重叠”。!

Page 42: Image Stitching Method

图像变化——前向与逆向映射

"   设变换前输入的像素坐标是(x, y),相应的变换后输出图像的

像素坐标为(u, v),变换的前向映射和逆

向映射分别定义为:

Page 43: Image Stitching Method

前向映射

"   前向映射扫描输入的图像,把每个图像像素(x, y)的亮度值按照上式拷贝到(u, v)指定的像素位置!

Page 44: Image Stitching Method

逆向映射

"   逆向映射从输出图像点(u, v)出发,通过(U-1, V-1),找到它在输入图像中的位置(x, y),并把该位置处像素的亮度值传给图像中的(u, v)像素点。!

Page 45: Image Stitching Method

"   如图所示,逆向映射避免了空洞的出现,它保证了输出图像的点都可以被扫描到。!

Page 46: Image Stitching Method

图像的插值

"   两种方法:最邻近点插值法和双线性插值法!

Page 47: Image Stitching Method

最邻近点插值法

"   插值点的灰度值与其最邻近点的灰度值相同 "   优点:简单、快速!

Page 48: Image Stitching Method

⽅方法:

Page 49: Image Stitching Method

"   采用这种插值法引入的误差比较大,常出现马赛克现象!

Page 50: Image Stitching Method

双线性插值法

"   根据输入图像网格上的像素值来确定差值点的灰度值!

Page 51: Image Stitching Method

⽅方法:

Page 52: Image Stitching Method
Page 53: Image Stitching Method

光照调整

"   由于光照条件不同,采集的原始图像在亮度上会有较大变化,因此直接拼接会在图像的重叠区域产生亮度的跳

变,给人不真实的感。为了在最终拼合的图像中得到流

畅的效果,必须对其进行预处理。!

Page 54: Image Stitching Method

常⽤用⽅方法

"   均值、方差是颜色传输中常用的两个统计参数,可使用这两个参数对待拼接图像进行调整,将一幅图像的统计

特征赋给待拼接的另外一幅,最终使二者整体亮度一致。!

Page 55: Image Stitching Method

具体过程

Page 56: Image Stitching Method

效果与局限性

"   差值相差较大的话,会导致灰度值超出阈

值(0,255)而导致失真

"   无法自动判别出以哪一幅图为参照图

Page 57: Image Stitching Method

改良算法的提出

²  将调整系数设为

两幅图像素平均

值之差的一半  ²  一幅图减去这个

系数,另一幅图

加上这个系数 �

Page 58: Image Stitching Method

光照调整的局限性

"   如果原始照片曝光不合适,大片像素点全白或全黑,则光照调整后的效果不佳

"   调整范围如果较大的话,会导致灰度值超出阈值(0,255)而导致失真

²  照片光照水平相差不大时,用线性加权的融合方法过渡

即可 �

Page 59: Image Stitching Method

接缝过渡

"   线性加权融合法 "   I(x,y) = w(x,y)IL(x,y)+(1-w(x,y))IR(x,y)

"   W(x,y)为加权函数,其取值与该点到拼接中线的距离线性相关。!

Page 60: Image Stitching Method

成果演⽰示 Demo演示

Page 61: Image Stitching Method