-
由于周围环境变化,每一时刻所拍摄的图像都不相同,目标图像跟踪是在一个“匹配-修正-预测”的过程中实现的。传统的帧相关跟踪原理是利用在前一帧图像建立的图像模板与下一帧或后面连续几帧的图像进行模板匹配,不断查询搜索与目标模板最相似的图像,即为最佳匹配图像,并将其作为新的跟踪点继续进行跟踪[21]。图 1为模板匹配流程。
如图 2所示, 本文中假设待搜索图像S的大小为(xS, yS),模板M的大小为(xM, yM),模板M在图像S上平移,搜索窗口所覆盖的子图记为M′,其中(xi, yi)为子图M′的左上角顶点在图像S中的坐标,最终通过比较M和M′的相似性,完成模板匹配过程。
传统的模板匹配算法准确度高、计算量大,且在面临目标突然遭遇激光照射等强光干扰情况下被遮挡或消失时算法不稳定,不能有效地对目标继续跟踪,如图 3所示。为此,作者提出了一种改进的基于局部特征分块的跟踪算法。
-
针对采用传统跟踪算法在面临高能激光干扰时目标受到遮挡或丢失等现象,本文中采用一种基于局部特征分块的图像跟踪算法。主要思想是基于局部特征对跟踪模板进行分块处理,计算分块模板的特征稳定度信息,选取其中有效的块模板,然后对每个块在当前帧的跟踪区域内进行模板匹配,最后将分块匹配结果合并。图 4是本文中的相关跟踪整体算法流程。
算法具体步骤见下:
(1) 对读入的每一帧图像进行预处理(中值滤波、灰度直方图等)。
(2) 确定目标,首次确认需要用波门锁定目标以便选择模板。判断当前帧是否为初始帧,若是,则建立跟踪模板并保存;若不是,则判断是否已存在模板,有模板时则对当前帧计算sobel特征,无模板则继续下一帧处理。
模板一般以被跟踪目标的中心坐标(x0, y0)为中心,即所谓跟踪波门的中心。模板的大小即波门大小,是根据目标的特征和跟踪系统的实时性综合而定。模板位置和大小确定后即把图像数据存入模板M(xM, yM),如图 5所示。
(3) 根据历史缓存信息预测下一帧目标的可能位置及跟踪范围,并在预测的范围内进行模板匹配。若匹配有效,锁定目标位置,保存当前帧图像、波门内图像、当前帧时间戳信息和当前波门坐标位置信息,并更新模板,继续跟踪;若匹配无效,则算法进入第(4)步开始分块跟踪过程。其中,关于预测和匹配过程说明如下。
预测:预测算法是取连续几帧缓存数据的历史坐标信息和每帧时间戳信息,计算出x和y方向上目标运动的平均速度,从而预测出当前帧中目标的中心位置,区域大小一般选定为模板(xM, yM)的整数倍。
匹配:判断模板匹配有效性时,建立匹配图保存跟踪范围内各个位置与跟踪模板的匹配度,匹配公式由下式计算:
$ \begin{aligned} R &=\sum\limits_{0}^{x_\boldsymbol{M}} \sum\limits_{0}^{y_\boldsymbol{M}}\left[\boldsymbol{M}\left(x_\boldsymbol{M}, y_\boldsymbol{M}\right)-\right.\\ & \boldsymbol{M}^{\prime}\left(x+x_\boldsymbol{M}, y+y_\boldsymbol{M}\right) ]^{2} \end{aligned} $
(1) 式中, M代表模板图像,大小为(xM, yM),M′为模板图像搜索时所覆盖的S区域的子图,其中(xi, yi)为子图M′的左上角顶点在图S中的坐标。R是M′在S中每个位置的匹配度,该匹配度越小表示相关性越大。经过匹配运算后,依次求得R值(R1, R2, …,RxS×yS)。求取R中最小值,并验证匹配是否有效:
$ \left\{\begin{array}{ll}{R_{\min } < R_{1}} & {(2 \mathrm{a})} \\ {R_{\min }>R_{\mathrm{h}}}& {(2 \mathrm{b})}\\ {R_{1}< R_{\min }< R_{\mathrm{h}}}& {(2 \mathrm{c})}\end{array}\right. $
式中,Rmin表示匹配运算后所求得的匹配度R的最小值,Rh和Rl表示为了验证匹配是否有效所设定的最高阈值和最低阈值。(2a)式为匹配有效且更新模板,(2b)式为匹配无效,(2c)式为匹配有效且无需更新模板。
(4) 局部特征分块算法。当有强光干扰匹配无效时,进入局部特征分块处理。图 6为局部特征分块算法流程图。
(a) 对当前帧图像和模板进行sobel特征处理。
(b) 为了达到高帧频低延时的图像跟踪要求,此处分为粗跟踪和精跟踪两种情况。精跟踪时采用最临近插值法对模板和当前帧图像进行缩放调整以提高运算速度降低运算时间;粗跟踪时则使用原始的模板和当前帧图像,不做缩放变换。后将精跟踪缩放变换的模板或粗跟踪的原始模板进入下面的步骤(c)中进行分块处理; 最临近插值法不改变图像内容的前提下改变图像尺寸,分别由水平缩放系数U和垂直缩放系数V决定,这里一般取工程经验值:
$ \left\{\begin{array}{l}{x^{\prime}=U(x, y)} \\ {y^{\prime}=V(x, y)}\end{array}\right. $
(3) 式中,(x′, y′)为变换后图像像素点的位置坐标,(x, y)为源图像中的位置坐标。
(c) 将当前跟踪模板分成n块,块的大小根据波门决定,即块的高与宽分别和模板的高与宽成比例,模板大小为xM×yM,块的大小为p×g,整个模板包括n=c×d个分块,则有xM=p×c, yM=g×d。对分块进行优选是基于目标的角点检测特征和纹理频谱特征的,根据目标角点特征的分布和频域中易于识别的纹理模式进行分块选择。
(d) 计算每个块的sobel特征积分图I,根据预先设置好的阈值将被强光干扰和遮挡的块模板舍弃掉,在余下的块中选择目标块。
选取时把每个块的局部特征积分图Ii(i=1, 2, 3, …, n),(n为分块的总块数)按照值的大小进行降序排列,将分块模板中稳定性最高即局部特征值最为突出的前T块作为新的跟踪模板,选取时需满足:
$ \frac{{\sum\limits_{i = 1}^T {{\mathit{\boldsymbol{I}}_i}} }}{{\sum\limits_{i = 1}^n {{\mathit{\boldsymbol{I}}_i}} }} \ge {R_{\rm{e}}} $
(4) 式中,Re为解释度,表示应选取的前T块模板的特征值之和占据所有特征值的比例不小于Re,一般该值的设置都在80%以上,这样只用其中几个块模板就能够表示出目标模板的主要特征。
(e) 对跟踪模板块分别进行模板匹配,对每个跟踪模板块的匹配过程中利用(1)式计算匹配图,并根据匹配图确定分块的匹配度和与之对应的坐标,得到匹配结果。
(f) 将T个跟踪模板块的匹配结果进行合并$H=\sum\limits_{i=1}^{T} h(i) $,最终得到目标位置。
(g) 根据合并后的匹配度利用(2)式验证匹配是否有效,若匹配有效,则目标输出、更新模板;匹配无效进入第(5)步。
(5) 进入记忆跟踪。利用保存的最近6帧历史模板信息采用帧差法对当前帧进行运动检测,检测到运动物体后,将历史模板与预处理后的图像进行模板匹配,验证匹配有效性。匹配有效退出记忆跟踪,进入正常跟踪状态;若无效,则取出下一个缓存的历史模板重新进行匹配;若所有历史模板均匹配无效,则读入下一帧视频,对当前帧重复上述过程。记忆跟踪流程如图 7所示。
一种基于局部特征分块的目标跟踪算法
A target tracking algorithm based on local feature segmentation
-
摘要: 为了解决传统目标跟踪算法在天空背景下面临高能激光反射时图像像素灰度分布发生剧烈变化, 从而导致目标遮挡或丢失的问题, 采用一种基于局部特征分块思想的相关跟踪算法, 根据局部特征对跟踪模板进行了分块处理, 计算并选取其中特征稳定度高的块模板, 在跟踪区域内对每个块做模板匹配, 并进行了理论分析和试验验证。结果表明, 该算法在强光干扰下能够有效地对目标实时稳定跟踪, 且图像处理延迟时间在2ms以内。该研究对基于高能激光发射下的超高精度跟踪系统工作性能的保证是有帮助的。Abstract: In order to solve the problem of occlusion or loss of targets caused by drastic change in gray distribution of image pixels by using traditional target tracking algorithms under high-energy laser reflection in the sky background, a correlation tracking algorithm based on local feature segmentation was adopted. The tracking template was divided into blocks according to local features. The block templates with high feature stability were calculated and selected. Template matching was performed for each block in the tracking area. The theoretical analysis and experimental verification were carried out. The results show that the algorithm can track the target stably in real time under strong light interference. And the image processing delay time is less than 2ms. This research is helpful to ensure the performance of ultra-high precision tracking system based on high-energy laser emission.
-
Key words:
- image processing /
- target tracking /
- local feature segmentation /
- template matching /
- high-energy laser
-
-
[1] YIN H P, CHEN B, CHAI Y, et al. Vision-based object detection and tracking: A review[J]. Acta Automatica Sinica, 2016, 42(10): 1466-1489(in Chinese). [2] QIU X R, PENG L, LIU Q Sh. Object tracking algorithm based on superpixel and discriminative sparsity[J]. Computer Engineering and Applications, 2018, 54(15): 1-5(in Chinese). [3] LU H Ch, LI P X, WANG D. Visual object tracking: A survey[J]. Pattern Recognition and Artificial Intelligence, 2018, 31(1): 61-76(in Chinese). [4] BAKER E S, DEGROAT R D. A correlation-based subspace tracking algorithm[J]. IEEE Transactions on Signal Processing, 1998, 46(11): 3112-3116. doi: 10.1109/78.726827 [5] CAO H Y. Research and application of target tracking algorithm based on DSP platform [D]. Xi'an: Xidian University, 2017: 1-3(in Chin-ese). [6] ZITOVÁ B, FLUSSER J. Image registration methods: a survey[J]. Image & Vision Computing, 2003, 21(11): 977-1000. [7] CHEN H Y, YANG Y. Rapid registration algorithm of large-scale images based on normalized gradient phase correlation [J]. Pattern Re-cognition and Artificial Intelligence, 2015, 28(8): 694-701(in Ch-inese). [8] CHIN F J, FANG Q, ZHANG T, et al. A fast critical arrhythmic ECG waveform identification method using cross-correlation and multiple template matching[C]//The 32nd Annual International Conference of IEEE.New York, USA: IEEE, 2010: 1922-1925. [9] XING C J, WEN L L, HE S Q. Target tracking of NCC fast matching method based on sequential similarity detection[J]. Electronic Design Engineering, 2015, 23(2): 187-190(in Chinese). [10] ZHANG G S, CHEN D Sh, QIU H T, et al. Design of high speed image tracking system based on FPGA[J]. Microelectronics & Computer, 2017, 34(4): 13-16(in Chinese). [11] DONG Y M. Visual object tracking based on correlation filters [D]. Beijing: Beijing Institute of Technology, 2015: 5-13(in Chinese). [12] XU Y Q, SHI Q H, QU Y D, et al. Study of image registration algorithm based on genetic algorithm [J]. Computer Science, 2016, 43(11A): 229-232(in Chinese). [13] SONG J H, YAN B L. Research on rapid mosaic technology of UAV aerial image based on SIFT [J].Computer Applications and Software, 2018, 35(2): 230-234(in Chinese). [14] ZHENG T, HAO X M, CHEN M. Mean Shift motion detection and tracking based on feature matching estimation[J]. Transducer and Microsystem Technologies, 2018, 37(7): 135-138(in Chinese). [15] ZHU H N, XU M M, SHEN Y. Research on multi video vehicle tracking based on mean shift [J]. Computer Science, 2018, 45(6A): 220-226(in Chinese). [16] YANG K, LIU G H, XU F. Mean shift tracking algorithm based on BCH and HOG[J]. Transducer and Microsystem Technologies, 2018, 37(7): 138-141(in Chinese). [17] SIDRAM M H, BHAJANTRI N U. Enhancement of mean shift tracking through joint histogram of color and color coherence vector[M]. New Deli, India:Springer, 2014: 547-555. [18] WEI B G, ZHAO S T, WEN X L. Multi-region tracking based on local histogram[J]. Computer Engineering and Application, 2018, 54(14): 26-33(in Chinese). [19] HOU T J. Design and implementation of image enhancement and template matching system based on FPGA [D]. Beijing: University of Chinese Academy of Sciences, 2016: 3-16(in Chinese). [20] FENG W, WANG Y D, ZHANG L. Deep feature extraction and classification recognition algorithm based on weighting and dimension reduction[J]. Laser Technology, 2018, 42(5):666-672(in Chin-ese). [21] CHEN J L, MIAO D, KANG B, et al. Research of target tracking based on Kalman filtering and template matching[J]. Optics & Optoelectronic Technology, 2014, 12(6): 9-12(in Chinese).