分类号:TP301.6 
10710-2014124046 
 
 
 
 
 
硕  士  学  位  论  文 
 
基于激光散斑的深度图获取算法研究 
 
侯旭阳 
   
 
 
导师姓名职称 
申请学位类别 
张绍阳 教授 
工学硕士 
学科专业名称  计算机应用技术 
论文提交日期 
2017 年 5 月 27 日  论文答辩日期  2017 年 6 月 4 日 
学位授予单位 
长安大学 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Study on the Algorithm of the Depth Image’s Acquiring 
Based on Laser Speckle 
A Thesis Submitted for the Degree of Master 
Candidate:Hou Xuyang 
Supervisor:Prof. Zhang Shaoyang 
Chang’an University, Xi’an, China 
 
II 
论文独创 性声 明
本 人声 明 : 本人所呈 交 的 学 位 论 文 是在 导 师 的 指 导 下 , 独立进 行 研 究 工
作 所 取得 的 成果 。 除论 文 中 已 经注 明 引 用 的 内 容 外 , 对 论 文 的 研 宄做 出 重
要 贡 献 的 个人和 集体 , 均 己 在文 中 以 明 确 方 式 标 明 。 本论文 中 不 包含任何
未 加 明 确 注 明 的 其他个人 或 集体 己 经公 开 发表 的 成果 。
本声 明 的 法律 责任 由 本 人 承 担 。
论 文 作 者签 名 :
年 4 月 沴
曰
>〇门
论文 知识 产权权属 声 明
本人在导 师 指 导 下 所完成 的 论 文 及 相 关 的 职务 作 品 , 知 识 产 权归 属 学
校 。 学 校享有 以 任何方 式 发表 、 复 制 、 公 开 阅 览 、 借 阅 以及 申 请 专利 等权
利 。 本 人 离 校 后 发表 或 使 用 学 位论 文 或 与 该 论 文 直 接相 关 的 学 术 论 文 或成
果 时 , 署 名 单位仍 然为长安 大 学 。
( 涉 密 论 文在解密 后 应遵 守此规 定 )
论文 作 者签 名 :
f s年 / 月 爷 曰
导 师 签 名 :
^
年
7
月 3■
日
.
〈
r
摘  要 
深度图像是指将从图像采集器到场景中各点的距离作为像素值的图像,它能有效的
区分前景和背景,对于目标识别更加高效。本文研究了现有的深度成像的成像原理和国
内外能达到量产的深度相机,目前国外已经有实时的检测大范围、含有运动场景、且成
本低的深度成像系统。由于技术封锁,国内的类似设备性能相对还较差。为此,本文对
基于激光散斑的深度图获取算法进行了深入的研究。 
首先,本文对激光散斑图像的成像原理、成像系统、散斑成像光栅进行了详细的研
究,对散斑图像的自相关性和互相关性进行了实验分析,对其作为空间结构光来进行深
度检测的可能性进行了研究。 
接着,本文对空间结构光获取深度的原理进行了研究,通过实验分析了深度与散斑
图像的关系,推导了深度图的计算公式。提出了一种高效的、简便的块匹配方法,快速
的获取深度图,详细叙述了使用这种快速块匹配方法获取整幅图像深度的具体流程。 
然后,本文对深度图像获取算法进行了优化,包括速度和精度的优化。在速度方面,
研究了匹配块的大小的选择;提出了一种搜索块大小动态可变的搜索方法;同时提出了
一种快速的匹配策略,大大降低计算量。在精度方面,在研究了散斑成像系统参数对精
度的影响因素的基础上,给出了从散斑成像系统参数上改善精度的方法;提出了一种横
向偏移量插值的插值算法以提高深度摄像头的深度分辨率。 
最后,通过实验表明:本文所使用的块匹配方法,在本文第三章所述散斑成像系统
参数下,深度精度在 50cm 处可以达到 1cm,在 200cm 处可以达到 5cm,可以满足大部
分的检测要求。在速度方面,把散斑图像传到处理器为双核 3.6Ghz,内存为 4GB 的 PC
机上,在 PC 机上进行的实验,计算一幅 1280*720 的深度图,时间可以达到 0.5s 以内。 
 
关键词:激光散斑,结构光,深度图,快速匹配方法 
 
 
 
 
i 
 
Abstract 
Depth  image means the  value of pixels  in  the image is  the distance between the object 
and  camera.  It  can  distinguish  the  foreground  and  background  effectively,  so  it  is  more 
efficient  for the target  recognition.  This  paper studied the principle of depth  camera  and the 
cameras  that  can  reach  mass  production.  At  present  there  are  already  the  depth  camera  that 
can detect a wide range, contains motion scene in real time, and the cost is low abroad. Due to 
technical  blockade, similar equipment’s performance is  relatively poor domestic.  In order to 
improve the performance, this paper studied the method of acquiring of depth image based on 
laser speckle. 
Firstly, this paper studied the principle, system and optical  grating of  speckle, analyzed 
the  self-correlation  and  cross-correlation  of  speckle  through  experiment.  Then  this  paper 
studied the possibility of the speckle image as a space structured light to detect the depth. 
Secondly, this paper  studied the principle of  the depth  image’s acquiring through space 
structured light, analyzed the relationship between depth image and speckle image,derived 
the formula of depth image. This paper proposed an efficient and easy block matching method, 
which can acquire depth image quickly, narrated the process of acquiring the whole image’s 
depth using the way of exclusive or block matching detailedly. 
Thirdly,  this  paper  optimized  the  arithmetic  of  the  depth  image  acquiring,  both  on 
speed and accuracy. In terms of speed, this paper studied the best choice of size of matching 
block, proposed a variable searching block size searching method, proposed a fast  matching 
strategy,  to  reduce  the  calculation  greatly.  In  terms  of  accuracy,  this  paper  studied  the 
influence of speckle image system’s parameter and introduce the way to improve the accuracy 
through adjust the speckle image system’s parameter. Then this paper proposed a method of 
improving the accuracy, an interpolation method of crosswise offset interpolation to improve 
the depth camera’s resolution.   
Finally, the experimental results show that the block matching this paper proposed, with 
the speckle image  system’s parameter showed in chapter three of this paper, depth  accuracy 
can reach 1cm in the distance of 50cm and 5cm in the 200cm. This can satisfy the detection 
requirements for most scenes. In terms of speed, put the speckle images to personal computer 
ii 
with 3.60Ghz dual-core processor CPU and 4GB RAM configuration, and then do experiment 
on the PC, we can get a 1280 * 720 pixels depth image within 0.5 seconds. 
 
Keywords: Laser speckle, Structured light, Depth image, Fast matching method 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
iii 
 
目    录 
第一章  绪论 ........................................................................................................ 1 
1.1  研究背景和意义 .......................................................................................................... 1 
1.2  深度成像方法研究 ...................................................................................................... 2 
1.2.1  被动式成像方法 .............................................................................................. 3 
1.2.2  主动式成像方法 .............................................................................................. 5 
1.2.3  不同的深度检测方法的比较 .......................................................................... 8 
1.3  国内外研究现状 .......................................................................................................... 9 
1.3.1  国外研究现状 .................................................................................................. 9 
1.3.2  国内研究现状 ................................................................................................. 11 
1.4  本文的主要研究内容 ................................................................................................ 12 
1.5  本文结构安排 ............................................................................................................ 13 
第二章  散斑的产生与特性分析 ...................................................................... 14 
2.1  激光散斑理论基础 .................................................................................................... 14 
2.1.1  激光散斑产生原理 ........................................................................................ 14 
2.1.2  激光散斑测量方法 ........................................................................................ 15 
2.2  散斑空间结构光的产生 ............................................................................................ 16 
2.3  散斑空间结构光的特性分析 .................................................................................... 19 
2.3.1  散斑图像自相关特性分析 ............................................................................ 20 
2.3.2  散斑图像间互相关特性分析 ........................................................................ 22 
2.4  本章小结 .................................................................................................................... 24 
第三章  基于激光散斑获取深度图算法 .......................................................... 25 
3.1  基于散斑图的深度测量公式推导 ............................................................................ 25 
3.1.1  深度测量公式推导 ........................................................................................ 25 
3.1.2  散斑模式的研究 ............................................................................................ 26 
3.2  深度与偏移量关系研究 ............................................................................................ 28 
3.2.1  深度与偏移量的理论计算 ............................................................................ 28 
3.2.2  深度与偏移量的实验测量 ............................................................................ 30 
3.3  深度图获取的实现算法 ............................................................................................ 31 
3.3.1  深度图获取流程 ............................................................................................ 31 
3.3.2  散斑图像的预处理 ........................................................................................ 33 
IV 
3.3.3  快速块匹配法检测深度的过程 .................................................................... 35 
3.4  本章小结 ..................................................................................................................... 38 
第四章  深度图获取算法的优化 ...................................................................... 39 
4.1  计算速度优化 ............................................................................................................. 39 
4.1.1  匹配块大小讨论 ............................................................................................ 39 
4.1.2  动态搜索块 .................................................................................................... 41 
4.1.3  匹配策略优化 ................................................................................................ 43 
4.2  深度图精度优化 ......................................................................................................... 44 
4.2.1  影响深度精度的因素 .................................................................................... 45 
4.2.2  像素偏移量插值 ............................................................................................ 46 
4.3  本章小结 ..................................................................................................................... 47 
第五章  实验与性能分析 .................................................................................. 48 
5.1  实验环境 ..................................................................................................................... 48 
5.2  仿真实验过程与实验结果 ......................................................................................... 48 
5.3  速度与计算量分析 ..................................................................................................... 49 
5.4  精度分析 ..................................................................................................................... 50 
5.5  本章小结 ..................................................................................................................... 51 
第六章  总结与展望 .......................................................................................... 52 
6.1  工作总结 ..................................................................................................................... 52 
6.2  研究展望 ..................................................................................................................... 53 
参考文献 ............................................................................................................. 54 
攻读学位期间取得的研究成果 ......................................................................... 57 
致  谢 
 .............................................................................................................. 58 
 
 
V