public class DetectorCascade extends Object
VarianceFilter
and uses integral images. very fast. but an easy check to pass
The second step is a EnsembleClassifier
. This is more complicated but boils down to checking
very few pixels of a patch against those same few pixels in previously seen correct patches and
previously seen incorrect patches. Better than dumb variance, but also permissive
The final step is a NNClassifier
which quite literally does a normalised correlation between the
patch and variance positive and negative examples. An excellent way to see if a patch is more similar to
correct things than incorrect things, but obviously massively slow so this is only done when the other two classifiers
are sure.
Generally the first two drop 26,000 patches and 30 or so are checked with normalised correlation.
This is where TLD gets its detection speed.
The detector works across an overlapping grid of windows at different scales. These scales are controlled
by the size of the original box selected. The idea is that instead of checking arbitrary windows the grid windows
are checked. This means that you get checks across scales and x,y locations. The whole point is that you
make quick decisions about not checking completely incorrect windows quickly.Modifier and Type | Field and Description |
---|---|
int |
maxScale
The maximum scale factor to check as compared to the selected object dims.
|
int |
minScale
The minimum scale factor to check as compared to the selected object dims.
|
int |
minSize
The minimum window size, defaults to 25, a 5x5 pixel area.
|
int |
numFeatures
The number of features per tree in the
EnsembleClassifier |
int |
numTrees
The number of trees in the
EnsembleClassifier |
float |
shift
The shift applied, 0.1f by default
|
static int |
TLD_WINDOW_SIZE
The size to which TLD windows are reduced in order to be checked by
NNClassifier |
boolean |
useShift
Whether a shift value should be applied to all scales
|
Constructor and Description |
---|
DetectorCascade()
Initialise the cascade and the underlying classifiers using the default values
|
Modifier and Type | Method and Description |
---|---|
void |
cleanPreviousData()
resets the underlying
DetectionResult instance |
void |
detect(FImage img)
In their current state, apply each classifier to each window in order of
computational simplicity.
|
DetectionResult |
getDetectionResult() |
EnsembleClassifier |
getEnsembleClassifier() |
NNClassifier |
getNNClassifier() |
int |
getNumWindows() |
VarianceFilter |
getVarianceFilter() |
ScaleIndexRectangle |
getWindow(int idx) |
void |
init()
initialise the cascade, prepare the windows and the classifiers
|
boolean |
isInitialised() |
void |
release()
Release all underlying classifiers and rest windows etc.
|
void |
setImgHeight(int imgHeight) |
void |
setImgWidth(int imgWidth) |
void |
setObjHeight(int height)
FIXME? arguably this should change as the BB changes? would that be too slow?
|
void |
setObjWidth(int width)
FIXME? arguably this should change as the BB changes? would that be too slow?
|
void |
windowOverlap(Rectangle bb,
float[] overlap)
The overlap of a bounding box with each underlying window.
|
public static final int TLD_WINDOW_SIZE
NNClassifier
public int minScale
public int maxScale
public boolean useShift
public float shift
public int minSize
public int numFeatures
EnsembleClassifier
public int numTrees
EnsembleClassifier
public DetectorCascade()
public void release()
public void init() throws Exception
Exception
public void detect(FImage img)
Clustering
instance and cluster the selected windows.img
- public void setObjWidth(int width)
width
- sets the underlying scale windows in which to search based on factors of the original object detectedpublic void setObjHeight(int height)
height
- sets the underlying scale windows in which to search based on factors of the original object detectedpublic void cleanPreviousData()
DetectionResult
instancepublic int getNumWindows()
public void windowOverlap(Rectangle bb, float[] overlap)
getNumWindows()
bb
- overlap
- the outputpublic ScaleIndexRectangle getWindow(int idx)
idx
- ScaleIndexRectangle
instance which is the idxth windowpublic boolean isInitialised()
init()
has been called)public void setImgWidth(int imgWidth)
imgWidth
- the width of images to expectpublic void setImgHeight(int imgHeight)
imgHeight
- the height of images to expectpublic NNClassifier getNNClassifier()
NNClassifier
instancepublic DetectionResult getDetectionResult()
DetectionResult
instancepublic VarianceFilter getVarianceFilter()
VarianceFilter
instancepublic EnsembleClassifier getEnsembleClassifier()
EnsembleClassifier
instance