Mathematical Problems in Engineering

Volume 2015, Article ID 524120, 20 pages

http://dx.doi.org/10.1155/2015/524120

## CamShift Tracking Method Based on Target Decomposition

Key Laboratory of Advanced Electrical Engineering and Energy Technology, School of Electrical Engineering and Automation, Tianjin Polytechnic University, Tianjin 300387, China

Received 6 December 2014; Revised 23 January 2015; Accepted 23 January 2015

Academic Editor: Pasquale Memmolo

Copyright © 2015 Chunbo Xiu et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

In order to avoid the inaccurate location or the failure tracking caused by the occlusion or the pose variation, a novel tracking method is proposed based on CamShift algorithm by decomposing the target into multiple subtargets for location separately. Distance correlation matrices are constructed by the subtarget sets in the template image and the scene image to evaluate the correctness of the location results. The error locations of the subtargets can be corrected by resolving the optimization function constructed according to the relative positions among the subtargets. The directions and sizes of the correctly located subtargets with CamShift algorithm are updated to reduce the disturbance of the background in the tracking progress. Simulation results show that the method can perform the location and tracking of the target and has better adaptability to the scaling, translation, rotation, and occlusion. Furthermore, the computational cost of the method increases slightly, and its average tracking computational time of the single frame is less than 25 ms, which can meet the real-time requirement of the TV tracking system.

#### 1. Introduction

Target tracking is a key technology in computer vision field. It can be widely applied to industry, surveillance, robotics, human machine interface, and so forth [1–4]. It is a challenging task in real-world scenarios to track a target precisely due to the variability of the target’s movements, shapes, clutter, and occlusions. There are many factors which impact the tracking performance [5–8]. Firstly, the motion of the target is random and uncertain. The target may change its posture in the tracking process, which can lead to the scaling, translation, or rotation of the target in the tracking image. The size and shape of the target in the current scene may be different from those in the previous one or the target template. Secondly, the illumination in the scene may be instable. Uneven illumination or variant brightness can cause disturbances to target tracking. Besides, complex background affects the tracking performance badly. Note that the complex background means that color of background is close to that of the target rather than that the content of the background is complex. In other word, it is difficult to distinguish the target from the background with the similar color.

Some tracking algorithms have been proposed to deal with the problems above. For instance, superpixel tracking can handle heavy occlusion and recover from drifts [9]. And patch-based tracking algorithm decomposes a target into several patches based on appearance similarity and spatial distribution to recognize the target in the complex background [10]. Generally, improving the accuracy of the target model is one of the effective methods to enhance the location accuracy, but it has the cost of computational time. Therefore, a method is needed to model an accurate target and perform target tracking precisely with less computation. MeanShift [11, 12] algorithm and CamShift (Continuously Adaptive Mean-SHIFT) [13] algorithm have attracted more attention of scholars for their characteristics of fast matching. Particularly, CamShift can adaptively adjust the size of the target area, so that it has good adaptability to the pose variation of the target [14, 15]. These two methods have good tracking performance under the condition of high-contrast between the target and the background. However, when the background is complex, the adaptive adjustment of the size of the target area can be disturbed by some background information, which may cause lower modeling accuracy, location error, or even tracking failure [16]. Therefore, some improved methods are proposed to enhance the accuracy of the location. For instance, one of the effective ways is to fuse some other features [17, 18], such as shape, edge, or texture, to improve the modeling precision. However, that needs a larger computational cost and makes the model more complex.

In order to improve the reliability of the target tracking algorithm, an improved CamShift tracking strategy is proposed to enhance the performance of the target tracking. The target is decomposed into multiple subtargets. Each subtarget is tracked separately by CamShift algorithm. The error locations of subtargets can be corrected according to the relative positions among all the subtargets. The target can be synthesized by these subtargets. In this tracking strategy, the error correction can enhance the reliability of target tracking result in high location accuracy. Particularly, this strategy shows the good adaptability when the target is occluded. Different from the superpixel tracking algorithm [9] and patch-based tracking algorithm [10], the method proposed in this paper adopts the CamShift algorithm to perform the subtarget tracking, and the correct tracking result can be obtained by the error correction as long as some of the subtargets are located correctly.

#### 2. Subtarget Set and Distance Correlation Matrix

Suppose that the target contains distinguishing feature areas. Each distinguishing feature area can be regarded as a subtarget. All the subtargets are grouped into a subtarget set . Thus, the target can be described by the subtarget set .

One element in the subtarget set represents the center coordinates of one subtarget accordingly. Set the center coordinates ofthe subtarget as (, ); the subtarget set can be described as

The distance between the th and the th subtargets is defined as
where (, ) and (, ) are the center coordinates of the th and the* j*th subtargets in the subtarget set* U*.

The distance correlation matrix of the subtarget set can be defined as

The target motion can be seen as the rigid body motion, and the ratios of the relative distances among all the subtargets are fixed. According to these relative distances, error locations of subtargets can be corrected.

#### 3. Target Tracking Based on Target Decomposition

After the target decomposing, the hue histogram of each subtarget is modeled in the HSV color space, CamShift algorithm is used to locate every subtarget, and the error locations of subtargets can be corrected by optimization calculation. The position of the target in the scene can be determined according to the locations of subtargets. The target tracking process can be described as follows.

*Step 1. *Set the position coordinates of the th pixel in the th subtarget region as , , and the center position coordinates of the th subtarget as . The hue histogram of the th subtarget can be defined as
where is the hue levels. is the probability distribution of the hue, represents the characteristic value of the hue quantified of the pixel , and is the Kronecker delta function defined as
is the Gaussian basis functions defined as
where is the bandwidth of the Gaussian basis functions.

*Step 2. *The probability projection image of the search window of each subtarget can be built by the back-projection of the hue histogram. Set to be the hue characteristic value of the pixel in the search window of the th subtarget. The gray value of the pixel in the probability projection image can be defined as
where the symbol represents the rounding operation. The larger the gray value of the pixel in the probability projection image, the larger the probability that the pixel belongs to the target area.

*Step 3. *Zero and first order moments of the search window can be calculated as

*Step 4. *The center of mass of the search window can be calculated as

*Step 5. *Adaptively adjust the size of the search window as

Move the center of the search window of the subtarget to its center of mass. Repeat Step 2 to Step 5 until the shift distance is less than the threshold.

*Step 6. *Judge the location correctness of the subtargets.

Suppose that the coordinate is the located position of the subtarget . The new subtarget set in the scene can be defined as

The new distance correlation matrix of the subtarget set in the scene can be defined as

The correctness of the subtargets located can be judged according to the difference between the two distance correlation matrixes and . Firstly, centers ; and can be got by and as follows:

Secondly, based on the centers above, kernel functions can be defined as where , , and .

The sum function of the kernel functions above is defined as

The position corresponding to the maximum of the sum function is determined as the kernel center , and the judgment matrix is defined as where where is the center threshold. If all elements in the row are zero, that is, , , it can be determined that the subtarget is located wrongly.

*Step 7. *Correct the error locations of subtargets.

If the error location subtargets exist, they can be corrected by the subtargets located correctly. Suppose that there are subtargets located correctly, the center coordinates of the subtarget is (, ), where , and the center coordinates corrected of the error location subtarget is . The distance between them can be defined as

The evaluation function can be defined as

The best corrected center coordinates are determined where the evaluation function above is minimized.

*Step 8. *Adjust the direction angle and size of the subtargets located correctly.

Second order moments of the search window can be calculated as
Thus,

The major axis of the ellipse area of the subtarget is calculated as
where

The minor axis of the ellipse area of the subtarget is calculated as
where

The direction angle of the ellipse area of the subtarget is calculated as
where

The direction angles and sizes of the error location subtargets are not adjusted.

*Step 9. *Return to Step 1 to track the target in the next scene.

In (17), is the ratio of the distances and . When all the subtargets are located correctly, all the ratios , ; ; and are equal for the geometric similarity regardless of whether the scale of the target varies or not. In other words, the kernel center represents the geometric similarity ratio of the targets in the template image and the scene image. When the difference between and is large, at least one subtarget, or , may not be located correctly. The corrected position of the subtarget located wrongly corresponds to the minimization result of the evaluation function . So, in (17)–(21), the ratio of the relative distances between the subtargets in the target template and the scene is used to judge the correctness of the tracking results, which can ensure that the tracking strategy is also effective to the scale variation of the target. Therefore, the tracking strategy has good adaptability to the translation, rotation, scaling, and occlusion of the target.

#### 4. Simulation Results

The tracking strategy proposed in this paper is used to perform the target tracking in the complex circumstances of the target partial occlusion, the pose variation, and target scaling. The feasibility and effectiveness of the proposed method is shown by the comparative analysis with the basic CamShift algorithm and the improved CamShift algorithm based on multifeature fusion [18].

##### 4.1. Tracking Experiment for the Target Occluded Partially

Figure 1 shows the initial template, the white ellipse, in the first frame scene. The rear elevation of the car is chosen as the initial template which contains two red taillights, one blue license plate, and one black rear window. The target partial occlusion occurs during the video sampling.