public class CirculantTracker<T extends boofcv.struct.image.ImageGray<T>>
extends java.lang.Object
Tracker that uses the theory of Circulant matrices, Discrete Fourier Transform (DCF), and linear classifiers to track a target and learn its changes in appearance [1]. The target is assumed to be rectangular and has fixed size and location. A dense local search is performed around the most recent target location. The search is done quickly using the DCF.
Tracking is performed using texture information. Since only one description of the target is saved, tracks can drift over time. Tracking performance seems to improve if the object has distinctive edges.
CHANGES FROM PAPER:
[1] Henriques, Joao F., et al. "Exploiting the circulant structure of tracking-by-detection with kernels." Computer Vision–ECCV 2012. Springer Berlin Heidelberg, 2012. 702-715.
| Modifier and Type | Field and Description |
|---|---|
protected boofcv.struct.image.GrayF64 |
cosine |
protected boofcv.struct.image.GrayF64 |
gaussianWeight |
protected boofcv.struct.image.InterleavedF64 |
gaussianWeightDFT |
protected float |
offX |
protected float |
offY |
protected georegression.struct.shapes.RectangleLength2D_F32 |
regionOut |
protected georegression.struct.shapes.RectangleLength2D_F32 |
regionTrack |
protected boofcv.struct.image.GrayF64 |
template |
protected boofcv.struct.image.GrayF64 |
templateNew |
| Constructor and Description |
|---|
CirculantTracker(double output_sigma_factor,
double sigma,
double lambda,
double interp_factor,
double padding,
int workRegionSize,
double maxPixelValue,
boofcv.alg.interpolate.InterpolatePixelS<T> interp)
Configure tracker
|
| Modifier and Type | Method and Description |
|---|---|
static void |
circshift(boofcv.struct.image.GrayF64 a,
boofcv.struct.image.GrayF64 b) |
protected static void |
computeAlphas(boofcv.struct.image.InterleavedF64 yf,
boofcv.struct.image.InterleavedF64 kf,
double lambda,
boofcv.struct.image.InterleavedF64 alphaf)
new_alphaf = yf ./ (fft2(k) + lambda); %(Eq.
|
protected static void |
computeCosineWindow(boofcv.struct.image.GrayF64 cosine)
Computes the cosine window
|
protected void |
computeGaussianWeights(int width)
Computes the weights used in the gaussian kernel
This isn't actually symmetric for even widths.
|
void |
dense_gauss_kernel(double sigma,
boofcv.struct.image.GrayF64 x,
boofcv.struct.image.GrayF64 y,
boofcv.struct.image.GrayF64 k)
Gaussian Kernel with dense sampling.
|
static void |
elementMultConjB(boofcv.struct.image.InterleavedF64 a,
boofcv.struct.image.InterleavedF64 b,
boofcv.struct.image.InterleavedF64 output)
Element-wise multiplication of 'a' and the complex conjugate of 'b'
|
protected static void |
gaussianKernel(double xx,
double yy,
boofcv.struct.image.GrayF64 xy,
double sigma,
boofcv.struct.image.GrayF64 output)
Computes the output of the Gaussian kernel for each element in the target region
k = exp(-1 / sigma^2 * max(0, (xx + yy - 2 * xy) / numel(x)));
|
protected void |
get_subwindow(T image,
boofcv.struct.image.GrayF64 output)
Copies the target into the output image and applies the cosine window to it.
|
boofcv.struct.image.GrayF64 |
getResponse() |
georegression.struct.shapes.RectangleLength2D_F32 |
getTargetLocation()
The location of the target in the image
|
boofcv.struct.image.GrayF64 |
getTargetTemplate()
Visual appearance of the target
|
static double |
imageDotProduct(boofcv.struct.image.GrayF64 a)
Computes the dot product of the image with itself
|
void |
initialize(T image,
int x0,
int y0,
int regionWidth,
int regionHeight)
Initializes tracking around the specified rectangle region
|
protected void |
initialLearning(T image)
Learn the target's appearance.
|
void |
performLearning(T image)
Update the alphas and the track's appearance
|
void |
performTracking(T image)
Search for the track in the image and
|
protected void |
resizeImages(int workRegionSize) |
void |
setTrackLocation(int x0,
int y0,
int regionWidth,
int regionHeight)
Used to change the track's location.
|
protected void |
subpixelPeak(int peakX,
int peakY)
Refine the local-peak using a search algorithm for sub-pixel accuracy.
|
protected void |
updateTrackLocation(T image)
Find the target inside the current image by searching around its last known location
|
protected boofcv.struct.image.GrayF64 templateNew
protected boofcv.struct.image.GrayF64 template
protected boofcv.struct.image.GrayF64 cosine
protected georegression.struct.shapes.RectangleLength2D_F32 regionTrack
protected georegression.struct.shapes.RectangleLength2D_F32 regionOut
protected boofcv.struct.image.GrayF64 gaussianWeight
protected boofcv.struct.image.InterleavedF64 gaussianWeightDFT
protected float offX
protected float offY
public CirculantTracker(double output_sigma_factor,
double sigma,
double lambda,
double interp_factor,
double padding,
int workRegionSize,
double maxPixelValue,
boofcv.alg.interpolate.InterpolatePixelS<T> interp)
output_sigma_factor - spatial bandwidth (proportional to target) Try 1.0/16.0sigma - Sigma for Gaussian kernel in linear classifier. Try 0.2lambda - Try 1e-2interp_factor - Try 0.075padding - Padding added around the selected target. Try 1workRegionSize - Size of work region. Best if power of 2. Try 64maxPixelValue - Maximum pixel value. Typically 255public void initialize(T image, int x0, int y0, int regionWidth, int regionHeight)
image - Image to start tracking fromx0 - top-left corner of regiony0 - top-left corner of regionregionWidth - region's widthregionHeight - region's heightpublic void setTrackLocation(int x0,
int y0,
int regionWidth,
int regionHeight)
x0 - top-left corner of regiony0 - top-left corner of regionregionWidth - region's widthregionHeight - region's heightprotected void initialLearning(T image)
protected static void computeCosineWindow(boofcv.struct.image.GrayF64 cosine)
protected void computeGaussianWeights(int width)
protected void resizeImages(int workRegionSize)
public void performTracking(T image)
image - Next image in the sequenceprotected void updateTrackLocation(T image)
protected void subpixelPeak(int peakX,
int peakY)
public void performLearning(T image)
public void dense_gauss_kernel(double sigma,
boofcv.struct.image.GrayF64 x,
boofcv.struct.image.GrayF64 y,
boofcv.struct.image.GrayF64 k)
sigma - Gaussian kernel bandwidthx - Input imagey - Input imagek - Output containing Gaussian kernel for each element in target regionpublic static void circshift(boofcv.struct.image.GrayF64 a,
boofcv.struct.image.GrayF64 b)
public static double imageDotProduct(boofcv.struct.image.GrayF64 a)
public static void elementMultConjB(boofcv.struct.image.InterleavedF64 a,
boofcv.struct.image.InterleavedF64 b,
boofcv.struct.image.InterleavedF64 output)
protected static void computeAlphas(boofcv.struct.image.InterleavedF64 yf,
boofcv.struct.image.InterleavedF64 kf,
double lambda,
boofcv.struct.image.InterleavedF64 alphaf)
protected static void gaussianKernel(double xx,
double yy,
boofcv.struct.image.GrayF64 xy,
double sigma,
boofcv.struct.image.GrayF64 output)
xx - ||x||^2yy - ||y||^2protected void get_subwindow(T image, boofcv.struct.image.GrayF64 output)
public georegression.struct.shapes.RectangleLength2D_F32 getTargetLocation()
public boofcv.struct.image.GrayF64 getTargetTemplate()
public boofcv.struct.image.GrayF64 getResponse()