@Reference(type=Inproceedings, author={"Viola, P.","Jones, M."}, title="Rapid object detection using a boosted cascade of simple features", year="2001", booktitle="Computer Vision and Pattern Recognition, 2001. CVPR 2001. Proceedings of the 2001 IEEE Computer Society Conference on", pages={" I","511 "," I","518 vol.1"}, number="", volume="1", customData={"keywords"," AdaBoost; background regions; boosted simple feature cascade; classifiers; face detection; image processing; image representation; integral image; machine learning; object specific focus-of-attention mechanism; rapid object detection; real-time applications; statistical guarantees; visual object detection; feature extraction; image classification; image representation; learning (artificial intelligence); object detection;","doi","10.1109/CVPR.2001.990517","ISSN","1063-6919 "}) public class StageTreeClassifier extends Object
Stage
s have null
Stage.failureStage()
s, then the
tree is known as a cascade.
The general idea is that for a given window in the image being tested
(defined by an x,y position and scale), the stage tree is evaluated. If when
evaluating the tree a leaf node is hit (i.e. a Stage
that passes
successfully, but has a null
Stage.successStage()
) then
the tree is said to have passed, and indicates a potential object detection
within the window. If a Stage
fails to pass and has a
null
Stage.failureStage()
then the tree is said to have
failed, indicating the object in question was not found.
In order to achieve good performance, this implementation pre-computes and
caches variables related to a given detection scale. This means that it is
NOT safe to use a detector based on this stage
implementation in a multi-threaded environment such that multiple images are
being tested at a given time. It is however safe to use this implementation
with a detector that multi-threads its detection across the x and y window
positions for a fixed scale:
StageTreeClassifier cascade = ...
for each scale {
cascade.setScale(scale);
//the x and y search could be threaded...
for each y {
for each x {
cascade.matches(sat, x, y); {
}
}
}
Constructor and Description |
---|
StageTreeClassifier(int width,
int height,
String name,
boolean hasTiltedFeatures,
Stage root)
Construct the
StageTreeClassifier with the given parameters. |
Modifier and Type | Method and Description |
---|---|
int |
classify(SummedSqTiltAreaTable sat,
int x,
int y)
Apply the classifier to the given image at the given position.
|
int |
getHeight()
Get the classifier height
|
String |
getName()
Get the classifier name
|
Stage |
getRoot()
Get the root
Stage of the classifier |
int |
getWidth()
Get the classifier width
|
boolean |
hasTiltedFeatures()
Does the classifier use tilted haar-like features?
|
void |
setScale(float scale)
Set the current detection scale.
|
public StageTreeClassifier(int width, int height, String name, boolean hasTiltedFeatures, Stage root)
StageTreeClassifier
with the given parameters.width
- the width of the classifierheight
- the height of the classifiername
- the name of the classifierhasTiltedFeatures
- are there tilted haar-like features in the classifiers?root
- the root of the tree of stagespublic void setScale(float scale)
classify(SummedSqTiltAreaTable, int, int)
.
Internally, this goes through all the stages and their individual classifiers and pre-caches information related to the current scale to avoid lots of expensive recomputation of values that don't change for a given scale.
scale
- the current scalepublic int classify(SummedSqTiltAreaTable sat, int x, int y)
This method returns the number of stages passed if all stages pass; if a stage fails, then (-1 * number of successful stages) is returned. For example a value of 20 indicates the successful detection from a total of 20 stages, whilst -10 indicates an unsuccessful detection due to a failure on the 11th stage.
sat
- the summed area table(s) for the image in question. If there
are tilted features, this must include the tilted SAT.x
- the x-ordinate of the top-left of the current windowy
- the y-ordinate of the top-left of the current windowpublic int getWidth()
public int getHeight()
public boolean hasTiltedFeatures()