«上一篇 下一篇»
  计算机工程  2021, Vol. 47 Issue (4): 234-240  DOI: 10.19678/j.issn.1000-3428.0057685
0

引用本文  

季皓宣烨, 梁鹏鹏, 柴玉梅, 等. 基于关键点及光流的平面物体跟踪算法[J]. 计算机工程, 2021, 47(4), 234-240. DOI: 10.19678/j.issn.1000-3428.0057685.
JI Haoxuanye, LIANG Pengpeng, CHAI Yumei, et al. Planar Object Tracking Algorithm Based on Key Points and Optical Flow[J]. Computer Engineering, 2021, 47(4), 234-240. DOI: 10.19678/j.issn.1000-3428.0057685.

基金项目

国家自然科学基金(61806181)

作者简介

季皓宣烨(1994-), 男, 硕士研究生, 主研方向为计算机视觉;
梁鹏鹏, 副教授、博士;
柴玉梅, 教授;
王黎明, 教授、博士

文章历史

收稿日期:2020-03-11
修回日期:2020-04-12
基于关键点及光流的平面物体跟踪算法
季皓宣烨 , 梁鹏鹏 , 柴玉梅 , 王黎明     
郑州大学 信息工程学院, 郑州 450001
摘要:为提高复杂场景下基于关键点的平面物体跟踪算法的鲁棒性,提出一种融合光流的平面物体跟踪算法。检测目标物体与输入图像的关键点及其对应描述符,由最近邻匹配方法构建目标与图像间关键点匹配集合,通过光流法构建相邻两张图像间关键点的对应关系,将已构建的关键点匹配集合与基于光流的对应关系通过加权平均的策略进行融合,得出修正的关键点匹配集合,根据关键点匹配估计目标物体在当前图像的单应性变换矩阵,从而完成目标跟踪。在POT数据集上的实验结果表明,与SIFT、FERNS等算法相比,在校正误差阈值为5时,该算法在所有图像序列上的平均跟踪精度达到66.67%,具有较好的跟踪性能。
关键词平面物体跟踪    关键点    光流法    惩罚系数    单应性变换    
Planar Object Tracking Algorithm Based on Key Points and Optical Flow
JI Haoxuanye , LIANG Pengpeng , CHAI Yumei , WANG Liming     
School of Information Engineering, Zhengzhou University, Zhengzhou 450001, China
Abstract: To improve the robustness of the planar object tracking algorithm based on key point in complex scenes, a planar object tracking algorithm based on key point using optical flow is proposed.The key points and their corresponding descriptors of the target and the input image are detected, and the nearest neighbor matching method is used to construct the key point matching set for the target and the image.Then optical flow is adopted to construct the correspondences between key points of the two adjacent frames.The constructed key point matching set and the optical flow-based correspondences are fused with a weighted average strategy to obtain a refined key point matching set.Finally, the target is tracked by estimating the homography transformation between the target and the current image based on the key point matching result.Experimental results on the POT dataset show that when the alignment error threshold is 5, the average tracking precision of the proposed algorithm reaches 66.67% for all image sequences, outperforming SIFT, FERNS and other algorithms.
Key words: planar object tracking    keypoint    optical flow method    penalty parameters    homography transformation    
0 概述

平面物体跟踪算法在增强现实、监控、基于视觉的控制和重建等计算机视觉邻域有着广泛的应用。近年来,研究人员对平面物体跟踪算法的研究取得了较大进展,但现实中的遮挡、模糊、尺度变换等各类复杂场景,会影响跟踪器的跟踪性能[1]。因此,需要设计一个鲁棒的平面物体跟踪算法以适应现实中的复杂场景。

平面物体跟踪算法分为基于关键点[2-4]的平面物体跟踪算法和基于区域[5-7]的平面物体跟踪方法。基于区域的方法直接使用图像中像素点的外观,并通过优化目标物体与输入图像之间的相似度度量确定目标物体的位置,这类方法容易受到尺度变换、部分遮挡以及快速移动等扰动因子的干扰[8]。而基于关键点的方法可以视作图像之间检测到的关键点的匹配问题,通过将目标物体描述为一组关键点以及带有关键点标识的描述符集合,使得这类方法能够捕捉到关键点及其局部区域外观的变化,从而能够充分探索目标物体本身的结构信息,使基于关键点的方法能够使图像在受到旋转、光照以及视角变换等扰动因子下具备不变性[9]。此外,由于这类方法在跟踪过程中仅利用部分关键点匹配就能得到良好的跟踪结果,因此基于关键点的平面物体跟踪算法适合目标物体被部分遮挡的情况。相较于基于区域的方法,基于关键点的方法更能够适应复杂场景下的平面物体跟踪。

为进一步提高在各类复杂场景下基于关键点的平面物体跟踪算法的鲁棒性,本文提出一种基于关键点并融合光流的平面物体跟踪算法。对目标物体与输入图像分别检测关键点以及带有关键点标识的描述符,通过最近邻匹配方法建立目标物体与输入图像之间的关键点匹配集合,利用光流法计算图像序列中目标物体关键点的光流,计算出目标物体的关键点在当前图像中的位置,得到图像之间关键点的对应关系。通过相应的惩罚系数,由加权平均的策略将已得到的两组关键点对应关系进行融合,得出修正后目标物体与输入图像之间的关键点匹配集合,通过鲁棒的几何验证方法估计目标物体相对于输入图像的单应性变换,从而得出当前图像中目标物体的位置,并在POT[10]数据集上进行实验证明。

1 相关工作 1.1 基于关键点的平面物体跟踪算法

通过局部描述符寻找图像间的关键点对应关系,是基于关键点的平面物体跟踪算法的核心。该方法的目的是设计更健壮的局部描述符,并探寻利用距离度量改善描述符匹配。文献[4]将关键点匹配问题转换为分类问题,在进行分类器的训练时,将一个关键点的外观集合当作一个类用以训练分类器,因此,计算的开销转移到训练阶段的方法能够快速地执行关键点的分类。文献[11]使用朴素贝叶斯分类框架来表达关键点识别问题,通过数百个简单的二进制特征描述关键点邻域图像斑块,并使用分类器计算每个关键点类别的后验概率。为了在跟踪过程中利用空间和时间的一致性,文献[12]通过一个度量学习驱动方法学习了一个鲁棒的基于关键点外观的模型。文献[13]对SIFT[2]和FERNS[11]进行改进,使它们能够在移动设备上进行实时跟踪。为充分探索对象的结构信息,减少各种扰动因素的干扰,文献[8]提出了基于图的跟踪器Gacker,文献[14]将关键点匹配和变换估计结合到一个统一的框架中,并且采用线性结构化支持向量机(SVM)使对象模型快速适应给定的环境。

1.2 光流法

光流法是一种利用光流方程求解目标在图像平面上运动参数的方法。基于光流的跟踪方法[15]由于高效的特性而受到广泛的关注。按照理论基础与数学方法的区别,文献[16]将光流计算技术分为基于梯度的方法、基于区域匹配的方法、基于能量的方法和基于相位的方法4种。基于梯度的方法称为微分法,利用时变图像灰度的时空微分计算像素点的速度矢量,具体代表为Horn-Schunck光流计算方法[17],该方法通过在光流基本约束方程的基础上附加全局平滑假设,从而计算出光流场。文献[18]采用有条件的平滑约束,通过加权矩阵的控制对梯度进行不同的平滑处理。针对多运动的估计问题,文献[19]提出了分段平滑的方法。基于区域匹配的方法[20-21]通过定位相似区域,由相似区域的位移计算光流,通过对图像序列进行时空滤波处理,使基于能量的方法[15, 22]适于均匀的流场。文献[23]提出了基于相位的方法,根据与带通速度调谐滤波器输出中的等相位轮廓相垂直的瞬时速度来定义分速度,使带通滤波器按照尺度、速度和定向来分离输入信号。针对大位移在弱纹理情况下的光流信息计算误差较大的问题,文献[24]提出一种基于改进V1-MT前馈模型的光流计算方法,能在大位移、弱纹理情况下更为准确地计算光流信息。近年来,利用神经网络建立的光流计算技术[25-26]取得了广泛的关注与研究。

2 基于关键点并融合光流的跟踪过程

在实现本文算法的过程中,对于基于关键点的平面物体跟踪算法的选取,由于基于SIFT[2]的平面物体跟踪算法是这类方法中的一个经典的方法,并且在平面物体跟踪任务中具有良好的表现[10],因此本文将目标物体的SIFT[2]关键点处的光流引入基于SIFT[2]的平面物体跟踪算法中。

基于关键点并融合光流的平面物体跟踪算法的主要思想是根据相应的惩罚系数,对由SIFT[2]和光流法建立的图像间的两组对应关系,通过加权平均的方式进行融合,生成最终的对应关系。这两个惩罚系数会根据不同算法在同一个有序图像序列下的表现,增强或削弱其对修正后匹配点位置的贡献。

2.1 基于SIFT的关键点匹配集合

对输入的带有目标物体M的图像序列I,需要使用SIFT[2]构建I中的图像与M之间的关键点匹配集合。对目标物体M,由高斯差分函数来识别潜在的对于尺度以及旋转不变的关键点。首先通过图像的尺度变换以及高斯差分生成高斯差分金字塔,寻找极值点确定候选关键点。然后通过泰勒展开去除低对比度的特征点,并由海森(Hessian)矩阵消除边缘的响应点。由上述方法对M构建关键点集合K0,以K0中每个关键点为中心采样周围16×16作为特征区域,计算区域内每个像素点的梯度幅值与方向,统计个数最多的方向为该关键点的主方向,将坐标轴旋转至主方向,随后将每个特征区域分为4×4的子域,每个子域计算8个方向($ 45°, 90°, \cdots , 360° $)的梯度方向直方图,通过绘制每个梯度方向的累加值,形成一个种子点,这样对16个子域生成16个包含8个方向向量的种子点,这样就生成了128维的SIFT特征向量,经过归一化后生成关键点的描述符集合$ {D}_{0} $,构建元组$ ({K}_{0}, {D}_{0}) $

为便于说明基于SIFT的匹配点集合的构建过程,以图像序列I中的第i张图像$ {I}_{i} $为例。用SIFT算法提取$ {I}_{i} $的关键点集合$ {K}_{{I}_{i}} $及存储关键点标识的描述符集合$ {D}_{{I}_{i}} $,构建元组$ ({K}_{{I}_{i}}, {D}_{{I}_{i}}) $。对$ {D}_{0} $中的第m个描述符$ {D}_{0, m} $以欧式距离作为相似度度量,采用暴力匹配的方式,找出$ {D}_{{I}_{i}} $中与$ {D}_{0, m} $最相似的描述符$ {D}_{{I}_{i}, n} $,由关键点的标识$ (m, n) $得到匹配的关键点对$ ({K}_{0, m}, {K}_{{I}_{i}, n}) $,可以表示M$ {I}_{i} $之间一对匹配的关键点。随后将元素$ ({K}_{0, m}, {K}_{{I}_{i}, n}) $送入关键点匹配集合$ {\varsigma }_{{I}_{i}}^{S} $中。重复上述过程直至遍历$ {K}_{0} $中所有的元素。至此,对图像$ {I}_{i} $构建出基于SIFT的关键点匹配集合$ {\varsigma }_{{I}_{i}}^{S} $

2.2 融合光流的关键点匹配集合修正

本文使用Lucas-Kanade[27]算法计算目标物体的关键点集合$ {K}_{0} $中每一个关键点的光流,该算法基于亮度不变假设和邻域光流相似假设两个不变性假设。基于上述两个假设,对时刻t时的图像函数Img(xyt)建立光流方程,由最小二乘法可得近似解:

$ \left(\begin{array}{c}\mathrm{\Delta }x\\ \mathrm{\Delta }y\end{array}\right)={\left(\begin{array}{cc}\sum \mathrm{I}\mathrm{m}{\mathrm{g}}_{x}^{2}& \sum \mathrm{I}\mathrm{m}{\mathrm{g}}_{x}\mathrm{I}\mathrm{m}{\mathrm{g}}_{y}\\ \sum \mathrm{I}\mathrm{m}{\mathrm{g}}_{x}\mathrm{I}\mathrm{m}{\mathrm{g}}_{y}& \sum \mathrm{I}\mathrm{m}{\mathrm{g}}_{y}^{2}\end{array}\right)}^{-1}\left(\begin{array}{c}-\sum \mathrm{I}\mathrm{m}{\mathrm{g}}_{x}\mathrm{I}\mathrm{m}{\mathrm{g}}_{t}\\ -\sum \mathrm{I}\mathrm{m}{\mathrm{g}}_{y}\mathrm{I}\mathrm{m}{\mathrm{g}}_{t}\end{array}\right) $ (1)

其中,$ \mathrm{I}\mathrm{m}\mathrm{g} $表示整幅图像,$ \mathrm{I}\mathrm{m}{\mathrm{g}}_{x}\mathrm{、}\mathrm{I}\mathrm{m}{\mathrm{g}}_{y}\mathrm{、}\mathrm{I}\mathrm{m}{\mathrm{g}}_{t} $分别表示$ \mathrm{I}\mathrm{m}\mathrm{g} $xyt的偏导数,由式(1)得出$ (\mathrm{\Delta }x, \mathrm{\Delta }y) $,表示在时刻$ t $xy方向的速度。

对有序图像序列I,有第一张图像$ {I}_{0} $以及预先指定的目标物体的关键点集合$ {K}_{0} $,对光流法F,有$ {L}_{{I}_{1}}=F\left({K}_{0}\right)\mathrm{ }, {L}_{{I}_{2}}=F\left({L}_{{I}_{1}}\right)\mathrm{ }, \cdots , {L}_{{I}_{n}}=F\left({L}_{{I}_{n-1}}\right) $,其中,$ {L}_{{I}_{n}} $$ {I}_{n} $中与$ {K}_{0} $对应的点的集合,与$ {K}_{0} $中的坐标是一一对应的。同理,对图像$ {I}_{i} $,由上述过程得出的点的集合$ {L}_{{I}_{i}} $,由$ {L}_{{I}_{i}} $$ {K}_{0} $构建对应关系$ {\varsigma }_{{I}_{i}}^{L} $

$ {\varsigma }_{{I}_{i}}^{L}=\left\{\right({K}_{0, m}, {L}_{{I}_{i}, m}\left)\right|{K}_{0, \mathrm{m}}\in {K}_{0}, {L}_{{I}_{i}, m}\in {L}_{{I}_{i}}\} $ (2)

由于在构建$ {\varsigma }_{{I}_{i}}^{S} $$ {\varsigma }_{{I}_{i}}^{L} $时,$ {\varsigma }_{{I}_{i}}^{S} $$ {\varsigma }_{{I}_{i}}^{L} $所包含的元素并不总是一一对应的,因此为确保在修正时选取的$ {\varsigma }_{{I}_{i}}^{S} $$ {\varsigma }_{{I}_{i}}^{L} $中的元素均对应$ {K}_{0} $中的同一个关键点,对$ {K}_{0} $中每个元素都创建一个索引,构成索引集合Idx={1,2,…,O},其中O表示集合$ {K}_{0} $中元素的个数,在创建$ {\varsigma }_{{I}_{i}}^{S} $$ {\varsigma }_{{I}_{i}}^{L} $时,将对应$ {{\rm K}}_{0} $的元素的索引加入到各自集合的元素中,例如,对集合$ {K}_{0} $中索引为m的关键点$ {K}_{0, \mathrm{ }m} $,如果$ {\varsigma }_{{I}_{i}}^{S} $接受$ ({K}_{0, m}, {K}_{{I}_{i}, n}) $作为一对匹配的关键点,则将m加入到$ {\varsigma }_{{I}_{i}}^{S} $的元素$ ({K}_{0, m}, {K}_{{I}_{i}, n}) $中,更改为$ ({K}_{0, m}, {K}_{{I}_{i}, n}, m) $,同理将$ {\varsigma }_{{I}_{i}}^{L} $中的元素更改为$ ({K}_{0, m}, {L}_{{I}_{i}, m}, m) $,这样可以通过索引标识m确定$ {K}_{{I}_{i}, \mathrm{ }n} $$ {L}_{{I}_{i}, \mathrm{ }m} $对应的同一个关键点$ {K}_{0, \mathrm{ }m} $

由于加权平均融合方法简单高效,本文采用如下策略将基于局部特征描述的关键点匹配和光流信息进行融合。设置参数$ {\mu }_{1} $$ {\mu }_{2} $及半径$ r $,索引m对应集合$ {\varsigma }_{{I}_{i}}^{L} $中的元素$ ({K}_{0, m}, {L}_{{I}_{i}, m}, m) $与集合$ {\varsigma }_{{I}_{i}}^{S} $中的元素$ ({K}_{0, m}, {K}_{{I}_{i}, n}, m) $,记$ d $为点$ {L}_{{I}_{i}, m} $$ {K}_{{I}_{i}, n} $之间的欧式距离,$ {T}_{{I}_{i}, \mathrm{ }m} $表示修正后的点的坐标,调整的过程会出现3种情况:1)若$ 0\le d<{\mu }_{1}r $,则$ {T}_{{I}_{i}, m}=({L}_{{I}_{i}, m}+{K}_{{I}_{i}, n})/2 $,将$ ({K}_{0, m}, {T}_{{I}_{i}, m}) $送入集合$ {\varsigma }_{{I}_{i}} $中;2)若$ {\mu }_{1}r\le d<{\mu }_{2}r $,则$ {T}_{{I}_{i}, m}={\lambda }_{1}{L}_{{I}_{i}, m}+{\lambda }_{2}{K}_{{I}_{i}, n} $,其中$ {\lambda }_{1}\mathrm{、}{\lambda }_{2} $为惩罚系数,将$ ({K}_{0, m}, {T}_{{I}_{i}, m}) $送入集合$ {\varsigma }_{{I}_{i}} $中;3)若$ d\ge {\mu }_{2}r $,则不向集合$ {\varsigma }_{{I}_{i}} $加入任何元素。修正后的关键点匹配集合为:

$ \begin{array}{l}{{\mathit{\boldsymbol{\varsigma}}}}_{{{\mathit{\boldsymbol{I}}}}_{{\mathit{\boldsymbol{i}}}}}=\left\{\mathrm{ }\right({K}_{0\mathrm{ },m}\mathrm{ },{T}_{{I}_{i}\mathrm{ },m}\left)\mathrm{ }\right|\mathrm{ }\mathrm{\Delta }({K}_{{I}_{i}\mathrm{ },n}\mathrm{ },{L}_{{I}_{i}\mathrm{ },m})<{\mu }_{2}r,\\ {T}_{{I}_{i}\mathrm{ },m}=\mathrm{I}\mathrm{n}\mathrm{d}(0\le \mathrm{\Delta }({K}_{{I}_{i}\mathrm{ },n}\mathrm{ },{L}_{{I}_{i}\mathrm{ },m})<{\mu }_{1}r)\cdot \left(\frac{1}{2}{K}_{{I}_{i}\mathrm{ },n}+\frac{1}{2}{L}_{{I}_{i}\mathrm{ },m}\right)+\\ \quad \quad \mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{I}\mathrm{n}\mathrm{d}({\mu }_{1}r\le \mathrm{\Delta }({K}_{{I}_{i}\mathrm{ },n}\mathrm{ },{L}_{{I}_{i}\mathrm{ },m})<{\mu }_{2}r)\cdot \\ \quad \quad ({\lambda }_{1}{L}_{{I}_{i}\mathrm{ },m}+{\lambda }_{2}{K}_{{I}_{i}\mathrm{ },n})\mathrm{ },({K}_{0\mathrm{ },m}\mathrm{ },{K}_{{I}_{i}\mathrm{ },n})\in {\varsigma }_{{I}_{i}}^{S}\mathrm{ },\\ \quad \quad \mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }\mathrm{ }({K}_{0\mathrm{ },m}\mathrm{ },{L}_{{I}_{i}\mathrm{ },m})\in {\varsigma }_{{I}_{i}}^{L}\}\hspace{1em}\mathrm{ }\end{array} $ (3)

其中,Ind(x)为指示函数,当x成立时,Ind(x)=1,否则Ind(x)=0,$ \mathrm{\Delta }(a, b) $表示$ a\mathrm{、}b $之间的欧氏距离。

为计算$ {\lambda }_{1}\mathrm{、}{\lambda }_{2} $的值,本文基于以下的观察:在SIFT进行平面物体跟踪的过程中,图像序列中的前NN较小)张图像所预测的跟踪框通常是可靠的。基于该观察对图像序列中的前N张图像,计算这些图像中目标物体的单应性变换矩阵。由$ {K}_{0} $中元素的位置,通过透视变换得到变换后的点$ \mathrm{T}\mathrm{r}\mathrm{u}\mathrm{t}{\mathrm{h}}_{{I}_{i}} $。此时,记$ {C}_{L} $为仅使用Lucas-Kanade进行关键点对应时发生错误($ \mathrm{\Delta }({L}_{{I}_{i}, m}, \mathrm{T}\mathrm{r}\mathrm{u}\mathrm{t}{\mathrm{h}}_{{I}_{i}, m})>{\mu }_{1}r $)的次数,$ {C}_{S} $为仅使用SIFT进行关键点匹配时发生错误($ \mathrm{\Delta }({K}_{{I}_{i}, n}, \mathrm{T}\mathrm{r}\mathrm{u}\mathrm{t}{\mathrm{h}}_{{I}_{i}, m})>{\mu }_{1}r $)的次数。对$ ({\lambda }_{1}, {\lambda }_{2}) $的值,由式(4)计算:

$ ({\lambda }_{1}, {\lambda }_{2})=\left(\frac{{C}_{L}^{-1}}{{C}_{L}^{-1}+{C}_{S}^{-1}}, \frac{{C}_{S}^{-1}}{{C}_{L}^{-1}+{C}_{S}^{-1}}\right) $ (4)

通过式(3)、式(4)可以得出修正后的匹配点集合$ {\varsigma }_{{I}_{i}} $。由鲁棒的矩阵估计方法,对$ {\varsigma }_{{I}_{i}} $计算单应性矩阵$ {\mathit{\boldsymbol{H}}}_{{I}_{i}} $,由$ {\mathit{\boldsymbol{H}}}_{{I}_{i}} $与序列I中第1张图像中目标物体M的标注点,通过透视变换得出图像$ {I}_{i} $中目标物体的位置预测值$ {R}_{{I}_{i}} $,即为$ {I}_{i} $中目标的跟踪结果。算法1描述了基于关键点并融合光流的平面物体跟踪算法对输入图像序列中目标物体M的跟踪过程。

算法1  基于关键点并融合光流的平面物体跟踪算法

输入  图像序列I,第1张图像$ {I}_{0} $带有目标物体的标注$ {T}_{0} $,参数$ {\mu }_{1}, {\mu }_{2}, r, N $,距离函数$ \Delta $

输出  图像序列I的跟踪结果R

1.由$ {\mathrm{I}}_{0} $$ {\mathrm{T}}_{0} $得到目标物体M,提取M的SIFT关键点$ {\mathrm{K}}_{0} $

2.$ {\mathrm{C}}_{\mathrm{s}}=1, {\mathrm{C}}_{\mathrm{L}}=1 $

3.$ \mathrm{f}\mathrm{o}\mathrm{r}\mathrm{ }\mathrm{i}\mathrm{d}\mathrm{x}\mathrm{ }\mathrm{ }\mathrm{i}\mathrm{n}\mathrm{ }1:\mathrm{l}\mathrm{e}\mathrm{n}\left(\mathrm{I}\right) $

4.由SIFT算法检测到的图像$ {\mathrm{I}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $与M的关键点及对应的描述符,通过最近邻匹配方法得到$ {\mathrm{I}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $与M之间的关键点匹配集合$ {\mathit{\boldsymbol{\varsigma }}}_{{}_{\bf{i}\bf{d}\bf{x}}}^{\bf{S}} $

5.由Lucas-Kanade方法计算前一张图像$ {\mathrm{I}}_{\mathrm{i}\mathrm{d}\mathrm{x}-1} $$ {\mathrm{K}}_{0} $对应的点的集合中每个点的光流,得到M与当前图像$ {\mathrm{I}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $之间的对应关系$ {\mathrm{\varsigma }}_{{}_{\mathrm{i}\mathrm{d}\mathrm{x}}}^{\mathrm{L}} $

6.$ \mathrm{i}\mathrm{f}\mathrm{ }\mathrm{i}\mathrm{d}\mathrm{x}\le \mathrm{N} $

7.由$ {\mathrm{{\rm K}}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $$ {\mathrm{K}}_{0} $得到M相对于$ {\mathrm{I}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $的单应性变换矩阵$ {\mathrm{H}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $

8.由$ {\mathrm{H}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $$ {\mathrm{K}}_{0} $计算$ \mathrm{T}\mathrm{r}\mathrm{u}\mathrm{t}{\mathrm{h}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $

9.$ {\mathrm{K}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $表示$ {\mathrm{\varsigma }}_{{}_{\mathrm{i}\mathrm{d}\mathrm{x}}}^{\mathrm{S}} $每个元素的第2个值构成的数组

  $ {\mathrm{L}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $表示$ {\mathrm{\varsigma }}_{{}_{\mathrm{i}\mathrm{d}\mathrm{x}}}^{\mathrm{L}} $每个元素的第2个值构成的数组

10.$ {\mathrm{C}}_{\mathrm{S}}+=\mathrm{s}\mathrm{u}\mathrm{m}\left(\mathrm{\Delta }\right({\mathrm{K}}_{\mathrm{i}\mathrm{d}\mathrm{x}}, \mathrm{T}\mathrm{r}\mathrm{u}\mathrm{t}{\mathrm{h}}_{\mathrm{i}\mathrm{d}\mathrm{x}})>{\mathrm{\mu }}_{1}\mathrm{r}) $

11.$ {\mathrm{C}}_{\mathrm{L}}+=\mathrm{s}\mathrm{u}\mathrm{m}\left(\mathrm{\Delta }\right({\mathrm{L}}_{\mathrm{i}\mathrm{d}\mathrm{x}}, \mathrm{T}\mathrm{r}\mathrm{u}\mathrm{t}{\mathrm{h}}_{\mathrm{i}\mathrm{d}\mathrm{x}})>{\mathrm{\mu }}_{1}\mathrm{r}) $

12.$ ({\mathrm{\lambda }}_{1}, {\mathrm{\lambda }}_{2})=\left(\frac{{\mathrm{C}}_{\mathrm{L}}^{-1}}{{\mathrm{C}}_{\mathrm{S}}^{-1}+{\mathrm{C}}_{\mathrm{L}}^{-1}}, \frac{{\mathrm{C}}_{\mathrm{S}}^{-1}}{{\mathrm{C}}_{\mathrm{S}}^{-1}+{\mathrm{C}}_{\mathrm{L}}^{-1}}\right) $

13.$ \mathrm{f}\mathrm{o}\mathrm{r}\;\mathrm{ }\mathrm{m}\;\mathrm{ }\mathrm{ }\mathrm{i}\mathrm{n}\mathrm{ }\;0:\mathrm{l}\mathrm{e}\mathrm{n}\left({\mathrm{K}}_{0}\right) $

14.$ \mathrm{i}\mathrm{f}\;\mathrm{ }({\mathrm{K}}_{0, \mathrm{m}}, {\mathrm{K}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{n}}, \mathrm{m})\in {\mathrm{\varsigma }}_{\mathrm{i}\mathrm{d}\mathrm{x}}^{\mathrm{S}}\;\mathrm{a}\mathrm{n}\mathrm{d}\;\mathrm{ }({\mathrm{K}}_{0, \mathrm{m}}, {\mathrm{L}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}}, \mathrm{m})\in {\mathrm{\varsigma }}_{\mathrm{i}\mathrm{d}\mathrm{x}}^{\mathrm{L}} $

15.$ \mathrm{i}\mathrm{f}\;\mathrm{ }\mathrm{\Delta }({\mathrm{L}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}}, {\mathrm{K}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{n}})<{\mathrm{\mu }}_{1}\mathrm{r} $

16.$ {\mathrm{T}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}}=({\mathrm{K}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{n}}+{\mathrm{L}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}})/2 $

17.$ \mathrm{e}\mathrm{l}\mathrm{i}\mathrm{f}\;{\mathrm{\mu }}_{1}\mathrm{r}\le \mathrm{\Delta }({\mathrm{L}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}}, {\mathrm{K}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{n}})<{\mathrm{\mu }}_{2}\mathrm{r} $

18.$ {\mathrm{T}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}}={\mathrm{\lambda }}_{1}{\mathrm{L}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}}+{\mathrm{\lambda }}_{2}{\mathrm{K}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{n}} $

19.$ \mathrm{i}\mathrm{f}\;{\mathrm{T}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}}\mathrm{存}\mathrm{在} $

20.$ \mathrm{将}({\mathrm{K}}_{0, \mathrm{m}}, {\mathrm{K}}_{\mathrm{i}\mathrm{d}\mathrm{x}, \mathrm{m}})\mathrm{送}\mathrm{入}\mathrm{集}\mathrm{合}{\mathrm{\varsigma }}_{\mathrm{i}\mathrm{d}\mathrm{x}}\mathrm{中} $

21.由$ {\mathrm{\varsigma }}_{\mathrm{i}\mathrm{d}\mathrm{x}} $计算M相对于图像$ {\mathrm{I}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $的单应性矩阵$ {\mathrm{H}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $

22.由$ {\mathrm{H}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $$ {\mathrm{T}}_{0} $预测$ {\mathrm{I}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $中目标物体的位置$ {\mathrm{R}}_{\mathrm{i}\mathrm{d}\mathrm{x}} $

23.$ \mathrm{将}{\mathrm{R}}_{\mathrm{i}\mathrm{d}\mathrm{x}}\mathrm{送}\mathrm{入}\mathrm{集}\mathrm{合}\mathrm{R}\mathrm{中} $

24.$ \mathrm{r}\mathrm{e}\mathrm{t}\mathrm{u}\mathrm{r}\mathrm{n}\mathrm{ }\mathrm{R} $

3 实验

通过实验在公开数据集上评测了本文提出的算法(SIFT+OF),并与SIFT[2]、FERNS[11]、SURF[3]、SOL[14]、GPF[28]、SCV[6]、ESM[7]、GO-ESM[20]、IC[5]、L1APG[29]和IVT[30] 11个经典算法进行了比较。

3.1 数据集

实验所用数据集为POT数据集[10],该数据集对30个物体的7种运动状态进行采集,这7种运动状态分别是尺度变换、旋转、透视失真、运动状态的模糊、遮挡、出视野和无限制移动。POT数据集中每张图像的像素为1 280×720,有52 500张图像标注了目标物体4个角点的坐标,由于数据集中的图像序列均为野外场景拍摄,因此可以很好地模拟实际应用中复杂多变的环境。

3.2 评价指标

按照文献[10]中的评测办法,以校正误差作为评价指标,该指标基于物体的4个角点,计算跟踪器预测的跟踪结果与真实值之间的欧氏距离的平均值,如式(5)所示:

$ {e}_{\mathrm{A}\mathrm{L}}={\left(\frac{1}{4}\sum\limits _{i=1}^{4}({x}_{i}-{x}_{i}^{*}{)}^{2}\right)}^{\frac{1}{2}} $ (5)

其中,$ {x}_{i} $是跟踪器预测的目标物体的4个角点坐标,$ {x}_{i}^{*} $为真实标注的目标物体4个角点的坐标。

通过精度图反映跟踪器的质量[31],它表示校正误差$ {e}_{\mathrm{A}\mathrm{L}} $小于阈值$ {t}_{p} $的帧所占的百分比。

3.3 实验结果与分析

本次实验环境为Ubuntu16.04系统,使用OpenCV3.2.0设计实现,实验设备为CPU:Intel Core i7-7700HQ CPU,内存16 GB。实验参数设置为阈值$ {\mu }_{1}=1, {\mu }_{2}=3 $,半径$ r=3 $N=10。为验证SIFT与光流融合的平面物体跟踪算法(SIFT+OF)的有效性,本文实验评测了SIFT+OF在平面物体跟踪任务[10]中的跟踪精度以及跟踪速度。

3.3.1 平面物体跟踪任务

本节评估了SIFT+OF在POT数据集[10]上的跟踪精度,并与11个经典的平面物体跟踪算法[2-3, 5-7, 11, 14, 20, 28-30]的跟踪精度进行了比较。其中,除SIFT+OF外,其余算法的结果均引用文献[10]中的评测结果。图 1为12种算法在7种运动状态下的跟踪精度图以及所有状态下的平均结果,其中$ {t}_{p} $为校正误差阈值。表 1为校正误差阈值$ {t}_{p}=5 $时的跟踪精度,其中最优值加粗表示。

Download:
图 1 不同算法在POT数据集中的跟踪精度 Fig. 1 Tracking accuracy of different algorithms in the POT dataset
下载CSV 表 1 校正误差阈值为5时不同算法在POT数据集中的跟踪精度 Table 1 Tracking accuracy of different algorithms in the POT dataset when the correction error threshold is 5

实验结果表明,将SIFT与光流融合的平面物体跟踪算法(SIFT+OF)优于基于SIFT[2]的平面物体跟踪算法。特别地,在尺度变换(图 1(a)表 1)、透视失真(图 1(c)表 1)状态下取得最好的效果,运动模糊(图 1(d)表 1)优于基于SIFT的平面物体跟踪算法。从整体表现来看,在校正误差阈值为5时,SIFT+OF在POT数据集[14]中的跟踪精度与基于SIFT[2]的平面物体跟踪算法相比,提高了4.4%。

3.3.2 跟踪速度对比

由于SIFT+OF与基于SIFT[2]的平面物体跟踪算法相比增加了额外计算,为探究SIFT+OF的运行速度,本文对SIFT+OF与11种经典的跟踪算法的运行速度进行测评。表 2统计了各个算法的跟踪速度。

下载CSV 表 2 不同算法在POT数据集中的跟踪速度 Table 2 Tracking speed of different algorithms on the POT dataset  

表 2可以看出,对FERNS[11]而言,由于计算的开销转移至训练阶段,因此具有更高的运行速度,而SIFT+OF与SIFT[2]具有相似的运行速度,更具体地,SIFT[2]的跟踪速度为1.859 frames/s,略快于SIFT+OF的1.845 frames/s。因此,可得出SIFT+OF的运行速度稍慢于SIFT[2]算法。综合上述的实验结果及分析可以得出,本文提出的算法(SIFT+OF)能够在平面物体跟踪的评测任务中取得良好的表现,且具有较高的运行速度。

4 结束语

本文提出一种基于关键点并融入光流的平面物体跟踪算法。将Lucas-Kanade算法计算的目标物体关键点的运动信息融入SIFT算法特征匹配的过程中,根据加权平均策略对目标物体与输入图像关键点的对应关系进行调整,从而得出目标与输入图像关键点之间的对应关系。利用鲁棒的几何验证方法计算目标物体在当前图像中的单应性变换,基于该变换矩阵,通过目标物体关键点的角点坐标由透视变换得出跟踪结果。基于POT数据集52 500张带标注图像的实验结果表明,该算法相比经典的跟踪算法能够取得更高的跟踪精度。下一步研究是将基于深度学习的方法与本文提出的方法相结合,在保证跟踪速度的同时,提高对图像序列中目标物体的跟踪精度。

参考文献
[1]
LI Shanqing, TANG Liang, LIU Keyan, et al. A fast and adaptive object tracking method[J]. Journal of Computer Research and Development, 2012, 49(2): 383-391. (in Chinese)
李善青, 唐亮, 刘科研, 等. 一种快速的自适应目标跟踪方法[J]. 计算机研究与发展, 2012, 49(2): 383-391.
[2]
LOWE D G. Distinctive image features from scale-invariant keypoints[J]. International Journal of Computer Vision, 2004, 60(2): 91-110. DOI:10.1023/B:VISI.0000029664.99615.94
[3]
BAY H, TUYTELAARS T, VAN GOOL L. SURF: speeded up robust features[C]//Proceedings of European Conference on Computer Vision. Berlin, Germany: Springer, 2006: 404-417.
[4]
LEPETIT V, FUA P. Keypoint recognition using randomized trees[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2006, 28(9): 1465-1479. DOI:10.1109/TPAMI.2006.188
[5]
BAKER S, MATTHEWS I. Lucas-Kanade 20 years on: a unifying framework[J]. International Journal of Computer Vision, 2004, 56(3): 221-255. DOI:10.1023/B:VISI.0000011205.11775.fd
[6]
RICHA R, SZNITMAN R, TAYLOR R, et al. Visual tracking using the sum of conditional variance[C]//Proceedings of IEEE International Conference on Intelligent Robots and Systems. Washington D.C., USA: IEEE Press, 2011: 2953-2958.
[7]
BENHIMANE S, MALIS E. Real-time image-based tracking of planes using efficient second-order minimization[C]//Proceedings of IEEE/RSJ International Conference on Intelligent Robots and Systems. Sendai, Japan: [s. n. ], 2004: 943-948.
[8]
WANG Tao, LING Haibin. Gracker: a graph-based planar object tracker[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 40(6): 1494-1501.
[9]
MIKOLAJCZYK K, SCHMID C. A performance evalua-tion of local descriptors[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2005, 27(10): 1615-1630. DOI:10.1109/TPAMI.2005.188
[10]
LIANG Pengpeng, WU Yifang, LU Hui, et al. Planar object tracking in the wild: a benchmark[C]//Proceedings of 2018 IEEE International Conference on Robotics and Automation. Brisbane, Australia: [s. n. ], 2018: 651-658.
[11]
OZUYSAL M, CALONDER M, LEPETIT V, et al. Fast keypoint recognition using random ferns[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2010, 32(3): 448-461. DOI:10.1109/TPAMI.2009.23
[12]
ZHAO Liming, LI Xiao, XIAO Jun, et al. Metric learning driven multi-task structured output optimization for robust keypoint tracking[C]//Proceedings of the 29th AAAI Conference on Artificial Intelligence. Austin, USA: AAAI Press, 2015: 356-367.
[13]
WAGNER D, REITMAYR G, MULLONI A, et al. Real-time detection and tracking for augmented reality on mobile phones[J]. IEEE Transactions on Visualization and Computer Graphics, 2010, 16(3): 355-368. DOI:10.1109/TVCG.2009.99
[14]
HARE S, SAFFARI A, TORR P H S. Efficient online structured output learning for keypoint-based object tracking[C]//Proceedings of 2012 IEEE Conference on Computer Vision and Pattern Recognition. Rhode, USA: [s. n. ], 2012: 1894-1901.
[15]
WANG Bin, WENG Zhengkui, WANG Kun, et al. Real-time tracking method for eye feature points based on Lucas-kanada optical flow algorithm[J]. Computer Engineering, 2015, 41(7): 244-249. (in Chinese)
王彬, 翁政魁, 王坤, 等. 基于Lucas-Kanada光流法的人眼特征点实时跟踪方法[J]. 计算机工程, 2015, 41(7): 244-249. DOI:10.3969/j.issn.1000-3428.2015.07.047
[16]
ADELSON E H. The extraction of spatio-temporal energy in human an machine vision[C]//Proceedings of Workshop on Motion Representation and Analysis. Charleston, USA: [s. n. ], 1986: 213-227.
[17]
HORN B K P, SCHUNCK B G. Determining optical flow[C]//Proceedings of International Society for Optics and Photonics Conference on Techniques and Applications of Image Understanding. Kalifornien, USA: [s. n. ], 1981: 319-331.
[18]
NAGEL H H. On the estimation of optical flow: relations between different approaches and some new results[J]. Artificial Intelligence, 1987, 33(3): 299-324. DOI:10.1016/0004-3702(87)90041-5
[19]
BLACK M J, ANANDAN P. The robust estimation of multiple motions: Parametric and piecewise-smooth flow fields[J]. Computer Vision and Image Understanding, 1996, 63(1): 75-104. DOI:10.1006/cviu.1996.0006
[20]
SINGH A. An estimation-theoretic framework for image-flow computation[C]//Proceedings of Workshop on Image Understanding. Pittsburgh, USA: Morgan Kaufmann Pub, 1990: 314.
[21]
ANANDAN P. A computational framework and an algorithm for the measurement of visual motion[J]. International Journal of Computer Vision, 1989, 2(3): 283-310. DOI:10.1007/BF00158167
[22]
HAGLUND L. Adaptive multidimensional filtering[D]. Linköping, Sweden: Linköping University, 1991.
[23]
FLEET D J, JEPSON A D. Computation of component image velocity from local phase information[J]. Inter-national Journal of Computer Vision, 1990, 5(1): 77-104. DOI:10.1007/BF00056772
[24]
ZHANG Wenda, XU Yuelei, MA Shiping, et al. Optical flow calculating method based on multi-scale V1-MT feedforward model[J]. Computer Engineering, 2017, 43(9): 205-209. (in Chinese)
张文达, 许悦雷, 马时平, 等. 基于多尺度V1-MT前馈模型的光流计算方法[J]. 计算机工程, 2017, 43(9): 205-209. DOI:10.3969/j.issn.1000-3428.2017.09.036
[25]
DOSOVITSKIY A, FISCHER P, ILG E, et al. FlowNet: learning optical flow with convolutional networks[C]//Proceedings of IEEE International Conference on Computer Vision. Santiago, USA: [s. n. ], 2015: 2758-2766.
[26]
ILG E, MAYER N, SAIKIA T, et al. FlowNet 2.0: evolution of optical flow estimation with deep networks[C]//Proceedings of 2017 IEEE Conference on Computer Vision and Pattern Recognition. Honolulu, USA: [s. n. ], 2017: 1647-1655.
[27]
LUCAS B D, KANADE T. An iterative image registration technique with an application to stereo vision[C]//Proceedings of IEEE International Joint Conference on Artificial Intelligence. Washington D.C., USA: IEEE Press, 1981: 674-679.
[28]
KWON J, LEE H S, PARK F C, et al. A geometric particle filter for template-based visual tracking[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2014, 36(4): 625-643. DOI:10.1109/TPAMI.2013.170
[29]
BAO Chenglong, WU Yi, LING Haibin, et al. Real time robust l1 tracker using accelerated proximal gradient approach[C]//Proceedings of 2012 IEEE Conference on Computer Vision and Pattern Recognition. Washington D.C., USA: IEEE Press, 2012: 1830-1837.
[30]
ROSS D A, LIM J, LIN R S, et al. Incremental learning for robust visual tracking[J]. International Journal of Computer Vision, 2008, 77(1/2/3): 125-141.
[31]
WU Y, LIM J, YANG M H. Object tracking benchmark[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2015, 37(9): 1834-1848. DOI:10.1109/TPAMI.2014.2388226