You will implement three keys functions of the KCF tracker, described in High-Speed Tracking with Kernelized Correlation Filters by Henriques et.al.
Write a function function k = kernel_correlation(sigma, x, x_prime)
,
which computes gaussian kernel with bandwidth sigma for all displacements between input patches X and X_prime, which must both be MxN, in Fourier domain.
hat
stands for Fourier-transformed patches, X∗ is the complex-conjugate (function conj
) of X,
Functions fft2
and circshift
will help you. circshift
will set of the response map in the center of the image after ifft2(fft2())
, ⨀ stands for element-wise multiplication
Write function alphaf = train_kcf(x,yf,sigma,lambda)
, which computes filters values. yf
comes already in Fourier domain, sigma
is parameter for kernel_correlation
and lambda
is regularization parameter in Ridge regression. Division is element-wise. Output alphaf
should be in Fourier domain.
Write a function response_map = detect_kcf(x,z,sigma,alphaf)
. This function returns response map between patches X and Z, which must both be MxN, using alphaf weights. Convert response map to spatial domain by ifft2
before returning.
Examples of tho two patches, their pixel-wise difference and response map are shown in figure below
After finishing this 3 functions, run run_tracker.m
file to test tracker and save image output.