A Tracking Algorithm For PTZ Cameras
A Tracking Algorithm For PTZ Cameras
Abstract: This paper presents a tracking algorithm for PTZ (pan-tilt-zoom) cameras. The
tracked objects are Mini 1:43 scale RC cars that have been described by a unicycle model. The
algorithm is based on the combination of EKF (Extended Kalman Filter) and PF (Particle
Filters). A scanning procedure is used to explore the environment. Once targets are detected,
EKF is used to predict their future position. PTZ are then moved in order to guarantee a certain
probability of targets detection at the next time instant. If a target is lost, particle filters is
exploited. If target is found again EKF is restored. If this does not happen in a predefined
number of steps, the scanning procedure restarts.
62
NecSys'10
Annecy, France, Sept 13-14, 2010
Yw
a
v
p
Xw
63
NecSys'10
Annecy, France, Sept 13-14, 2010
SIR for PTZ cameras (lost target case) Fig. 6. SIR algorithm: example. Figure (a) shows in red
samples of the probability distribution p(x(k−1)) and
Require: η, p(x(k − 1)) and imax . η is the probability in green the N particles xj (k), j = 1, . . . , N . Figure
that a target is detected when inside a camera FOV (b) shows time k + 1. The target was not detected.
(usually close to 1). p(x(k − 1)) is the distribution of In green we have again the N particles xj (k) while in
the estimated state vector at time k − 1, i.e. x(k − red the resampled N particles x̃j (k). Figure (c) shows
1) ∼ N (x̄(k − 1), P̄ (k − 1)), where x̄(k − 1) and P̄ (k − 1) in red x̃j (k) and in green xj (k + 1), j = 1, . . . , N .
are computed via EKF. imax is the maximum number
of PF iterations. instead of the distribution of the predicted state vector at
time k.
Initialization. Extract N particles {Xj (k − 1)}j=1,··· ,N
= {xj (k − 1)}j=1,··· ,N from p(x(k − 1)). For j = The proposed SIR algorithm ends when the target is found
1, · · · , N , extract xj (k) ∼ px (·|xj (k − 1)) and set again. In such case EKF is restored. If this does not happen
Xj (k) = (Xj (k − 1), xj (k)). in a predefined number of steps, a scanning procedure is
while θ(k), ψ(k) and ζ(k) are such that target is not started. We do this since after some steps the uncertainty
detected do about future target positions will be so big that PF will
if the target is not detected for imax subsequent steps not help anymore. A possible scanning technique could be
then the one described in Avni et al. (2008).
compute θ(k + 1), ψ(k + 1) and ζ(k + 1) with a A potential problem of the SIR algorithm is loss of
predefined scanning procedure. diversity as particles with large weights are selected more
else and more often in step Resampling, eventually eliminating
set q j (k) = 1 − η if xj (k) is inside the projection of all other particles. The loss of diversity diminishes the
the image view and q j (k) = η otherwise. exploration capabilities of the algorithm. Therefore, we
Normalization. Normalize the weights q j (k) as explore particle filters just when a target is lost.
follows
q j (k) Figure 6 shows an example of our SIR algorithm.
q̃ j (k) = N
l
l=1 q (k) 4.3 Optimization Problem
Resampling. Extract N particles {X̃j (k)} from
the set {Xj (k)}j=1,··· ,N with replacement according The objective of the tracking algorithm is to compute
to importance weights q̃ j (k). cameras inputs, i.e. zoom, pan and tilt angles, in order
Prediction. For j = 1, · · · , N , extract xj (k + 1) ∼ to guarantee a certain probability of targets detection at
px (·|xj (k)) and set Xj (k + 1) = (Xj (k), xj (k + 1)) the next time instant while at the same time minimizing
variation w.r.t. previous inputs and maximizing target
Iteration. Compute θ(k +1), ψ(k +1) and ζ(k +1). resolution, i.e. ”zoom in” value. This problem can be
end if formulated as follows
Increment k. n
κ4
end while min κ1 Δθi2 + κ2 Δψi2 + κ3 Δζi2 +
Restart EKF. θi (k+1),ψi (k+1),ζi (k+1) ζi (k + 1)2
i=1
subject to cameras dynamics (2)
PF can deal with non-gaussian noise. We take advantage P (targetj ∈ F OV∪ (k + 1)) >= α
of that by describing accelerations in a more realistic way. ∀j = 1, . . . , m
For the same reason the Initialization phase starts from (5)
the distribution of the estimated state vector at time k − 1
64
NecSys'10
Annecy, France, Sept 13-14, 2010
where n and m are respectively the number of cameras and Suppose for example n = 3. When a = 1 we solve on the
targets, Δθi = θi (k + 1) − θi (k), Δψi = ψi (k + 1) − ψi (k), three processors in parallel the problems with active only
Δζi = ζi (k + 1) − ζi (k) and α is the required probability of camera 1 or 2 or 3. Then for a = 2, we solve in parallel the
detection. κ1 , κ2 , κ3 , κ4 are constants while F OV∪ (k + 1) problems with active cameras 1−2, 1−3, 2−3. For a = 3 we
is the union of cameras field of view at time k + 1. The have just to solve the problem with all the cameras active.
relation between FOVs and inputs is described in section In that case the clustering algorithm can be employed for
2.1. parallelizing the problem and speeding up the convergence.
When EKF is exploited, the probability of detection con- Another expedient for reducing the number of optimiza-
straint is assured by using the method described in Som- tion variables is to exclude a priori from the optimization
mariva and Vianello (2007), that numerically approxi- the cameras that can not really contribute in increasing
mates the integral of a bivariate normal distribution over target probability of detection. This evaluation can be
an arbitrary polygon. easily done by looking at cameras constraint (2).
When PF is used instead, the probability of detection is The application of parallel simulated annealing to our
assured by requiring at least a percentage α of particles to tracking problem deserves still further analysis and its use
be inside cameras FOV at the next time. in our test-bed is currently under investigation.
The optimization is performed by using Simulated Anneal- Another problem that deserves further investigation is the
ing (SA), see e.g. Kirkpatrick (1984), with time limit equal distributed Kalman/Particle Filtering estimation, see e.g.
to the sampling time. Olfati-Saber (2007), Simonetto and Keviczky (2009).
5. RESULTS
Parallel Simulated Annealing One of the major draw- The tracking algorithm presented in Section 4 has been
backs of simulated annealing is its very slow convergence, tested in our laboratories. In order to speed up commu-
especially for problems with large search space. Under the nication and computation, the algorithm has been imple-
assumption that each camera has a dedicated processor on mented in C. For the moment one car - one camera scenario
board and communication between cameras is available, a has been considered. We have used the following settings:
parallel versions of SA can be implemented. We assume ΔT = 0.3s, σ1 = 1m/s2 , σ2 = 15◦ /s2 , σx = σy = 0.01m,
also that cameras are calibrated, i.e. their homographies σφ = 5◦ , σv = 5m/s, σω = 45◦ /s. Particle filter generates
are known to all the cameras. There have been many at- at each time N = 1000 particles. η = 0.05 and imax = 4.
tempts to develop parallel versions of simulated annealing, κ1 = κ2 = 1, κ3 = κ4 = 0.1. Simulated annealing
see e.g. Aarts and Korst (1989). One of the approaches has been used with initial temperature T0 = 30, final
described in Aarts and Korst (1989) is the clustering temperature Tend = 0.1 and cooling coefficient αc = 0.98.
algorithm. Such algorithm takes advantage of the fact that The benchmark in Figure 7 has been used for comparing
a good initial solution provides SA faster convergence. the performances of PF only and EKF+PF.
Initially, the n cameras of the network run SA algorithm
using different initial solutions. It is assumed that proces-
sors have different number seeds. After a fixed number of
iterations, they exchange their partial results. The best
partial solution is then used as new initial solution for all
processes and SA is started again. This process is repeated
until time limit (i.e. sampling time) is exceeded.
When the number of targets and cameras involved in the
problem is big, the SA search space is very large. This
means that even finding a feasible solution to problem (5)
will be difficult, especially with a time limit constraint.
For this reason, one can think about solving problems
with a smaller number of optimization variables by fixing
some cameras inputs to their previous values, i.e. that Fig. 7. Benchmark. The blue crosses represent the target
cameras will not be moved. Given n, number of cameras, trajectory.
and na number of cameras we want to move, we can solve
n!
in parallel a!(n−a)! (all the possible combinations without The results are shown in Video1 (2010),Video2 (2010)
and summarized in Figure 8. For evaluating algorithms
repetitions) problems on different processors, i.e. cameras,
robustness, at frame 22 and 23 we assumed that the image
and then, by communicating, choose the minimum cost
was blurred and target not detected, even if effectively in
feasible solution. A possible strategy could be the follow-
the field of view. Both algorithms found again again the
ing:
target. However, if we look at Video2 (2010), frames 35-41
• start the procedure with a = 1 we see the effect ”loss of diversity” on PF performances.
• solve in parallel all possible combinations na for a
In fact, the red crosses, resampled particles close to the
fixed number of iterations measurement, are very few and also far from the real
• initialize all na SA optimization problems with the target position. For this reason the target is lost again
minimum cost feasible solution of a − 1 at frames 39 and 40 but fortunately found again. This
• iterate the procedure till time limit is exceeded. reasons, together with the costs (cumulative cost (5)) in
65
NecSys'10
Annecy, France, Sept 13-14, 2010
Figure 8, indicates that PF+EKF is more robust than PF Doucet, A., Godsill, S., and Andrieu, C. (2000). On
alone. sequential Monte Carlo sampling methods for Bayesian
Algorithm Cost nlost filtering. Statistics and computing, 10(3), 197–208.
PF 392.806 4 Everts, I., Sebe, N., and Jones, G. (2007). Cooperative
PF+EKF 305.444 2 object tracking with multiple ptz cameras. In the 14th
Intl Conf. on Image Analysis and Processing. Citeseer.
Fig. 8. PF vs EKF+PF: comparison of performances. Jazwinski, A. (1970). Stochastic processes and filtering
theory. Academic Pr.
Kirkpatrick, S. (1984). Optimization by simulated anneal-
6. CONCLUSIONS ing: Quantitative studies. Journal of Statistical Physics,
34(5), 975–986.
In this paper, a novel tracking algorithm for PTZ (pan- Muñoz-Salinas, R., Medina-Carnicer, R., Madrid-Cuevas,
tilt-zoom) cameras has been presented. A unicycle model F., and Carmona-Poyato, A. (2010). Particle filtering
has been used in order to describe targets behavior. The with multiple and heterogeneous cameras. Pattern
proposed tracking algorithm combines EKF and Particle Recognition.
Filters. EKF has been used in order to predict future Olfati-Saber, R. (2007). Distributed kalman filtering for
target position. PTZ cameras input are then computed sensor networks. In Proc. of the 46th IEEE Conf. on
in order to guarantee a certain probability of targets de- Decision and Control. San Diego, California.
tection at the next time instant. If a target is lost, particle Piciarelli, C., Micheloni, C., and Foresti, G. (2009). PTZ
filters is exploited. If target is found again EKF is restored. camera network reconfiguration. In Third ACM/IEEE
If this does not happen in a predefined number of steps, the International Conference on Distributed Smart Cam-
scanning procedure is restarted. The optimization problem eras, 2009. ICDSC 2009, 1–7.
is solved by simulated annealing. The results obtained on Raimondo, D., Gasparella, S., Struzenegger, D., Lygeros,
our experimental setup are promising. The possibility of J., and Morari, M. (2010). A tracking algorithm for
distributing the simulated annealing problem over several ptz cameras. Technical report, ETH Zürich, Switzer-
processors, i.e. several cameras, in order to speed up con- land. http://control.ee.ethz.ch/index.cgi?
vergence is under investigation. page=publications ;action=details;id=3609.
Simonetto, A. and Keviczky, T. (2009). Recent develop-
ACKNOWLEDGEMENTS ments in distributed particle filtering: Towards fast and
accurate algorithms. In Proc. of the 1st IFAC Work-
The authors would like to thank I. Lymperopoulos, G. shop on Estimation and Control of Networked Systems.
Gennari, P. Donaggio for the helpful discussions. Venice, Italy.
Sommariva, A. and Vianello, M. (2007). Product Gauss
REFERENCES cubature over polygons based on Greens integration
formula. BIT Numerical Mathematics, 47(2), 441–453.
Aarts, E. and Korst, J. (1989). Simulated annealing and Soto, C., Song, B., and Roy-Chowdhury, A. (2009). Dis-
Boltzmann machines. John Wiley & Sons New York. tributed multi-target tracking in a self-configuring cam-
Avni, O., Borrelli, F., Katzir, G., Rivlin, E., and Rot- era network. CVPR 2009.
stein, H. (2008). Scanning and tracking with indepen- Stein, G. (1999). Tracking from multiple view points: Self-
dent camerasa biologically motivated approach based on calibration of space and time. In cvpr, 1521. Published
model predictive control. Autonomous Robots, 24(3), by the IEEE Computer Society.
285–302. Video1 (2010). http://control.ee.ethz.ch/∼rdavide/EKF.avi.
Bellotto, N., Sommerlade, E., Benfold, B., Bibby, C., Video2 (2010). http://control.ee.ethz.ch/∼rdavide/PF.avi.
Reid, I., Roth, D., Fernández, C., Van Gool, L., and Yao, J. and Odobez, J. (2008). Multi-camera 3d person
Gonzalez, J. (2009). A distributed camera system tracking with particle filter in a surveillance environ-
for multi-resolution surveillance. In Third ACM/IEEE ment.
International Conference on Distributed Smart Cameras
(ICDSC 2009).
Black, J. and Ellis, T. (2006). Multi camera image
tracking. Image and Vision Computing, 24(11), 1256–
1267.
Crisan, D. and Doucet, A. (2002). A survey of convergence
results on particle filtering methods for practitioners.
IEEE Transactions on signal processing, 50(3), 736–746.
Czyz, J., Ristic, B., and Macq, B. (2007). A particle filter
for joint detection and tracking of color objects. Image
and Vision Computing, 25(8), 1271–1281.
Dinh, T., Yu, Q., and Medioni, G. (2009). Real time
tracking using an active pan-tilt-zoom network camera.
In Proceedings of the 2009 IEEE/RSJ international
conference on Intelligent robots and systems, 3786–3793.
IEEE Press.
Doucet, A., De Freitas, N., and Gordon, N. (2001). Sequen-
tial Monte Carlo methods in practice. Springer Verlag.
66