1. Introduction
Nowadays, moving target detection and tracking is an important area of research as it plays a vital role in several military, security surveillance and civilian applications (Karakaş, 2011; Theußl, 2018). Computer vision techniques and applications are widely used in this field of target detection and tracking (Du et al., 2017). These techniques provide reliable and dependable solutions for most of real-world tracking problems particularly in military applications for detecting and tracking the enemy targets (Mian, 2008). The availability of high precision, quality and cheap video cameras and rapid development in the field of digital computers, lead to a mutation for using object tracking in different fields. These fields include human-computer interaction, automobile driver assistance, video surveillance, video games, vehicle navigation, robotics, biometric and industrial automation and security (Yilmaz et al., 2006).
Computer vision is successfully used for detecting and tracking moving targets by processing video files. Video files composed of series frames, each of which can be processed as a two-dimensional 2-D image. Video files can be seen as a 2-D image through time (Khobahi, 2017). Video analysis is a complicated problem, and it can be summarized in three basic steps as follows (Samdurkar et al., 2017):
Detection of important moving objects.
Analysis of object tracks to recognize their behavior.
Tracking of such objects from frame to frame.
Detection of a target can be defined as catching the moving target while it moves, without any prior information about its position, velocity and orientation taking into consideration the percentage changes of its parameters such as position, velocity and acceleration (Iqbal et al., 2013). Reliable target tracking techniques require real time performance and low computation complexity for processing the detected target data and used in the higher-level applications where the location and motion parameters for targets are required (Salarpour et al., 2011). The main goal of any target tracking algorithm is to detect target motion with accurate values to put the target continuously in the Line-Of-Sight LOS of the tracking system.
Different tracking approaches were presented in the literature such as kernel tracking, point tracking and Silhouette Tracking, the details of such algorithms are introduced in (Hatwar et al., 2018; Simaria & Pipalia, 2015). Kalman filter presented a particular rule in object tracking field especially due to its ability to estimate the future object loci. Also, it can be considered an optimal recursive data processing algorithm. Kalman filter composed of a set of mathematical equations that provides an efficient estimation for system states, even with high uncertainty due to system modeling and related system and measurements noises.
Two stages of processing are performed, update stage for estimating the posteriori system states, and measurement stage that for updating the estimated states when a new measurement is received (Jammoussi & Afef, 2012; Kaittan & Saeed, 2017). The main task of Mean-shift tracking algorithm is to find the area of a video frame that is locally most like a previously initialized model. A histogram is used to represent the specified tracked image region. The algorithm moves the tracker to maximize the similarity score between the model and the current image region. Target is then represented by rectangular region (Laaroussi et al., 2018). Cam Shift is a modified algorithm based on mean shift as it is an effective color tracking technique. Cam shift is adaptive technique in which the rectangular region that represent target is changed continually in each frame to update target size (Joshi et al., 2014), a detailed description is presented in the following section.
Video file usually consists of two types of objects stationary and moving objects. Stationary objects do not always present notable change from frame to the next one in camera so it can be considered as a background scene. The quality of object tracking in a video sequence in the physical world is always potentially affected by five parameters:
The variation in the previous parameters is considerably influence the results of the tracking algorithm (Bradski, 1998; Emami & Fathy, 2011; Kalane & Loni, 2012; Patel & Thakore, 2013). Stepper motors are electromechanical devices with unique properties as they move in discrete steps. By energizing each phase in sequence, the motor will rotate one step at a time. Coordinator controlled stepper motors are widely used in positioning applications where high accuracy is necessary such as military weapons, robotics, printing, numerical control of machine tools, automotive, medical application, aerospace, and positioning application. Due to the great development of control techniques and fabrication applications, stepper motors are used extensively in position and velocity control (da Rocha & de Lima Tostes, 2013). Input to stepper motors is a train of pulses resulting in discrete angular and distinct steps. Hence, they are used in open loop applications with good performance. As they will be moving in distinct steps in a certain time hence the final position of the motor shaft will be known if the initial position is known (Altintas, 2009; Mahdavian et al., 2017). In some applications with a specific velocity or load torque, stepper motors may suffer from loss or slip in a step. To avoid this, closed loop control techniques are used to control stepper motors for better accuracy. Also, stepper motors suffer from the existence of resonances at certain speed ranges, high vibration, and noise levels due to step wise motion (Dong et al., 2012; Hasan et al., 2018). Control techniques used in closed loop applications of stepper motors use feedback information picked up from the stepper motor such as position, velocity, or stator parameters, this always utilized in sensor or sensor less techniques (Elsodany et al., 2011).
This paper presents the design and implementation of a high-performance real-time target tracking system. This system is based on modified coordinated target tracking algorithm by utilizing Cam-Shift and Kalman filter approaches for enhancing the tracking performance. Hybrid multimode stepper motors are used for reducing the system response time required for detecting and tracking the designated target. The developed system provides various advantageous from software and hardware points of view and can be summarized as follows:
Enhancing the performance of the tracking algorithm by integrating the Kalman filter and Cam-Shift algorithms to the coordinated target tracking algorithm. The Kalman filter estimates the future loci of the detected target, and the Cam-Shift algorithm adapts the tracking window for considering the target boundaries as the target moves close or away from the tracking system.
Improving the system response by utilizing a multi-mode hybrid stepper motor and switching between the full and micro-stepping modes based on the target state. After detecting the target, the algorithm drives the stepper motor to the full stepping mode to move rapidly to the detected target coordinates. Then, the algorithm drives the stepper motor to the micro-stepping mode as the tracking error reduced within ±5 degrees for reducing the system oscillation and smoothing the motor motion.
2. Cam-shift technique
Mean shift algorithm uses density-based appearance models to represent targets. Mean shift algorithm is used to detect the maxima of a density function of the data set in visual tracking. It is represented by a hill climbing that applied to a density histogram of the data. Mean-shift uses iterative searching to locate the target to find the extreme value of a probability distribution. Color histogram of the important object in the previous image creates a confidence map in the new image (Jeong et al., 2017). The peak of a confidence map near the object's old position is used by mean shift algorithm as shown in Figure 1.
Because of its relative simplicity and low computational cost mean-shift technique has been widely used, but it would fail in changing the scale of the tracking window when targets move away or toward from the camera because it uses static probability distributions without any updated during tracking. Many algorithms designed on the idea of mean-shift technique such as kernel-based object tracking, ensemble tracking and Cam- Shift (Kelek et al., 2016).
Based on mean-shift, continuous adaptive mean-shift Cam-Shift algorithm was designed to overcome its problems. Cam-Shift is an adaptive technique that adjusts the size of the tracking window and the distribution pattern of targets during tracking by computing the target's probability distribution in each frame. Cam-Shift algorithm tracks any kind of target's features distributions in a lightweight, robust, and efficient way (Allen et al., 2004). Using color data to represent targets for Cam-Shift technique gives a low complexity and practical performance. It has been object to a variety of modifications and improvements to accommodate other tracking applications.
The Cam-Shift algorithm starts with constructing a target’s initial search window and computing its color histogram. In each frame a probability distribution image relative to the target's histogram is constructed. By applying mean-shift algorithm the new size and location of the target are computed from the probability distribution image and is used as the initial size and location of the target in the next iteration (Emami et al., 2013). Several developments were proposed to improve Cam-Shift's performance and accuracy to enhance tracking targets. Cam-Shift works with a single-color histogram as the target representation. Using extra information rather than a single-color histogram to overcome algorithm's inaccuracy has been a popular extension to Cam-Shift among researchers. In (Artner & Burger, 2008) for instance, an improved version of Cam-Shift is proposed which uses texture information along with color information to represent and track targets in frame sequences. Several approaches use other tracking algorithms with Cam-Shift to improve the tracking performance. Using Kalman filter only when Cam-Shift fails to track targets was proposed in (Huang & Hong, 2011).
3. Kalman filter technique
Kalman filter is an optimal recursive estimator which estimates a wide range of the states of linear dynamic system. Minimizing the variance of the estimated states error can be considered one of the main advantages of Kalman filter algorithm. The potential of such an algorithm is due to its ability to measure outputs of current states and predict data required for estimating the future states of linear dynamic system. The algorithm is divided into two main steps, first predicting the system states based on the system and related noise models, and then updates the estimated states when a new measurement is received. According to errors in measured and prediction algorithms Kalman gain is set to optimal weight according to the error values. The coupling between Kalman filter and stepper motor enhances the stepper motor behavior and smooth its motion (Hamid et al., 2018; Laaraiedh, 2012). The representation of Kalman filter is described by equation 1-5.
Predication equation:
Measurement equation:
X k , P K Estimated mean and covariance of the state after seeing the measurement.
K k Filter gain.
The equation of motion for the target motion can be modeled as in Equations (6,7):
Where xt and Vt are the target position and velocity at time t, and a is the acceleration. Then generally the dynamics of the moving object can be simply described by the object position equation and its derivative as in Equations (6,7), also it can describe the motion in two-dimensions for the moving object.
Then, the state vector X in equation (4) can be described as follows:
The states disturbances and measurements noise are modeled as presented in (Kalane & Loni, 2012) a complete description for the states covariance matrix (Q) and measurement covariance matrix (R) is presented in (Kalane & Loni, 2012).
4. Main procedure of tracking algorithm
4.1. Detection
In this paper, object detection is fulfilled utilizing color detection-based algorithm due to its simplicity and efficiency as the object color is identified according HSV color theory which is a powerful way to define target. A certain color is set in the initial data and the algorithm senses it.
4.2. Analysis
After the detection algorithm starts, data of target are analyzed to pick up useful information and enhance target signal. A group of filters is designed to enhance target signal. Then the algorithm defines the target boundaries by a rectangular and compute target center. Target coordinates are extracted and written on the screen.
4.3. Tracking
The analyzed target data are used in the process of target tracking. The field of view in the front of camera is a planner image in which the algorithm can see the target in 2D plane as shown in Figure 2.
The X and Y coordinates are used to track targets by subtracting the system center from the target center. Error signal is computed and modified in each frame to update system tracking procedure as in Equations (6-9).
Xc: |
Center of camera frame in X axis |
Yc: |
Center of camera frame in Y axis |
Xt : |
Center of target frame in X axis |
Yt: |
Center of target frame in Y axis |
∆X : |
Distance of center of target from camera frame center in X axis |
∆Y : |
Distance of center of target from camera frame center in Y axis |
Error signal is processed by the Kalman filter to compute the future loci of target. The estimated region is modified by a Cam-Shift algorithm to fine searching for the target to ensure target location. An error signal is transmitted to the controller to update target coordinates. Specific area is set as a threshold to initiate the system tracking algorithm by setting the mode of operation of stepper motor to micro stepping mode.
4.4. Firing
The firing procedure begins after tracking the target to ensure stabilization of the tracking procedure. Good shooting depends on good tracking. After target destruction the target signal disappears, and the algorithm stopped. Positions of a target are predicted by Kalman filter, and then Cam-Shift is used to search and match the target in the predicted areas. The whole procedure of tracking algorithm is shown in Figure 3.
5. Experimental system construction and operation
The designed and implemented system is low cost, simple, rugged, and dependable. This system has two degrees of freedom in azimuth (X) and elevation (Y) planes. The proposed tracking algorithm is implemented using microcontroller embedded board and integrated with actuation system to detect targets based on their color then provide a high accuracy tracking based on modified Cam-Shift and Kalman filter technique. A laser source is integrated with the experimental setup of the proposed tracking system as a scale down testing system to verify the stability of tracking system with the designated target as the proposed system is designed to be extended for applications of laser gun.
A laser source is used for shooting the moving objects, the instance of shooting is chosen of the beginning with the tracking algorithm. Stepper motors are utilized to drive the tracking system in azimuth and elevation planes as they have several properties such as moving in steps which gives high accuracy, precise and effective in open loop applications. Stepper motors also have high torque to inertia ratio especially in low-speed applications, high mechanical reliability and brushless construction which made stepper motors more efficient for driving control systems.
The implemented system operates in two modes, the first one is the detection mode, where the system detects the target and coincides with the camera center on the center of the target. The second mode of operation is the tracking mode that starts immediately when the center of the camera system coincides with the center of the target, and the firing commands are generated to operate the laser gun. The laboratory real time detection, tracking and firing system is shown in Figure 4.
Targets starts when the system enters the tracking mode to ensure the stability of the laser beam at a certain position on the target. By continuously emitting laser beam on the target in the tracking mode, a certain part of the target such as wing will burn out and target will never be capable of continuing flying and falling.
5.1. USB camera
A USB camera is used in the detection of moving targets according to the target color. The video signal picked up by the USB camera which contains the target data, is transferred to a laptop software program (PYTHON) via serial port. The selected USB camera focal lens and light is manually changed to adjust the resolution of the images (this is a facility in the camera that makes it gives a wider range of operation in distance, bad weather and better image). After the detection algorithm finishes the tracking algorithm starts to track the object according to its color and the coordinate's error is delivered to the Arduino Uno microcontroller. The proposed procedure for detection and tracking the designated target is shown in the flowchart in Figure 3.
5.2. Hybrid stepper motor (HSM)
Two degrees of freedom with two hybrid stepper motors is implemented in azimuth (X) and elevation (Y) directions. Small steps, high static and dynamic torque are the key features of HSM. So, HSM is widely used in several applications. A stepper motor accurately tracks the moving object according to the control signal delivered from the microcontroller and stops at a certain object position.
5.3. Controller
A controller (Arduino-Uno) is used in the implemented system to generate control pulses required to start the motors and to control its operation. The choice of such a microcontroller board is based on its low-cost, reliability and it has a simple interface with the system components. The controller modifies the received target coordinates according to the target position and direction then delivered to update stepper motors with the coordinate's error. Figure 5 shows the functional block diagram of the experimental system.
6. Experimental results and analysis
In this section, to demonstrate the efficiency of the proposed tracking system real time online experiments are conducted. These experiments evaluate the capability of the developed software and hardware and their integrity for performing the task of target tracking with high performance while minimizing the time required for locking on the detected target by using full stepping mode. The tracking smoothness for reducing the system overshot during the tracking process using the micro stepping mode and Kalman filter estimator is also conducted for estimating the target predicted motion parameters. The experiments are divided into two case studies based on the type of the designated target motion parameters, stationary and moving targets are the most used situations for evaluating the tracking systems. The target motion is simulated using a scene generator that consists of a colored target with a pre-designed trajectory in azimuth and elevation planes. The target relates to a laser detector to indicate the efficiency of the tracking system. The stationary targets case is used to evaluate the proposed system hardware and software and their integrity in ideal conditions.
6.1. Stationary targets
This test is performed as an ideal environmental conditions case-study for evaluating the proposed algorithm and hardware integrity far from the effects of target motion dynamics as previously mentioned. The target is fixed at a certain location of the 2-D space in the camera system field of view as shown in Figure 2. The function of the tracking system is to bring the center of the camera frame to be aligned with the target center. The results in Figure 6 demonstrate the system response for tracking a stationary target using full-stepping mode of excitation. The results show an oscillatory behavior due to the vibration problems of stepper motors that lead to severe overshot and undershot at the start which represents a poor system performance. This reflects the advantage of using the proposed switch case criteria for starting with full stepping to rapidly lock on the target then switch to the micro stepping mode as shown in Figure 8.
Table 1 shows the statistical analysis of the previous case study. The results of mean, standard deviation, maximum and minimum errors reflect the better performance of hybrid (Cam-Shift and Kalman filter) than Cam-Shift only. The results show noticeable decrease in the statistical analysis parameters when applying Kalman filter as it estimates the future loci and filters the system ripples.
Method | Azimuth | Elevation | |||||||
Mean | STD | Max | Min | Mean | STD | Max | Min | ||
Full stepping | Cam-Shift | 0.15789 | 0.0605 | 0.3157 | 0 | 0.5338 | 0.41608 | 1.6842 | 0 |
Hybrid | 0.18213 | 0.0534 | 0.2631 | 1 | 0.5148 | 0.37861 | 1.6315 | 3 |
The results in Figure 7 demonstrate the system performance with static target while using micro-stepping excitation and employing the Cam-Shift and Kalman filter algorithm in tracking the target. The improvement of the system’s performance can be noticed. The transient regions decreased to one third of the full stepping case gradually with almost no oscillation until reaching the steady state region. Thus, the proposed estimation and switching case algorithms provided better performance when compared to the response in the previous case study shown in Figure 6 by reducing efficiently the motors overshoot.
Table 2 shows the statistical analysis of the previous case study. Like the previous case results show decrease in the statistical analysis parameters when applying Kalman filter as it estimates the future loci and compensate the system noise, in addition to the effect of micro-stepping mode to enhance the system transient oscillation.
6.2. Maneuvering target
Figure 8 shows a tracking experiment of maneuvering target. The system keeps tracking the target with a good dynamic behavior, and the error in this case is the error between target and the camera center. As the target has high dynamic behavior the output of statistical analysis with Kalman filter has a high value for mean error, standard deviation, maximum and minimum errors.
A zoomed area of Figure 9 (tracking of maneuvering target) is analyzed to show the validity of using Hybrid, Kalman filter and Cam-Shift, tracking algorithm technique. Curves with the tracking algorithms lead the recent loci curve and shifted with the estimated value of target speed.
From results in Table 3 Mean and standard deviation is slightly high because the target is moving and has a high dynamic, Kalman Filer reduces its dynamic by estimation of the future loci.
7. Conclusions
In this paper, an improved real-time on-line target tracking system is designed and implemented experimentally based on Cam-Shift and Kalman filtering tracking techniques. The used stepper motors are excited in the full stepping and micro stepping modes to minimize the overall working time and improve system response by minimizing the oscillatory response of stepper motors, respectively. Kalman filtering tracking technique is used to estimate the future loci of the target to enhance the dynamics of the overall trajectory. The Cam-Shift tracking technique is used to adapt the detection window of target area. Two groups of tests are conducted to test and reflect the dependency of the proposed system in visual tracking the targets.