Package boofcv.alg.tracker.tld
Class TldFernClassifier<T extends ImageGray<T>>
java.lang.Object
boofcv.alg.tracker.tld.TldFernClassifier<T>
Manages ferns, creates their descriptions, compute their values, and handles their probabilities.
-
Field Summary
Modifier and TypeFieldDescriptionprotected TldFernDescription[]
protected TldFernManager[]
protected int
protected int
-
Constructor Summary
ModifierConstructorDescriptionprotected
TldFernClassifier
(Random rand, int numFerns, int descriptorSize, int numLearnRandom, float fernLearnNoise, InterpolatePixelS<T> interpolate) Configures fern algorithm -
Method Summary
Modifier and TypeMethodDescriptionprotected int
computeFernValue
(float c_x, float c_y, float rectWidth, float rectHeight, TldFernDescription fern) Computes the value of the specified fern at the specified location in the image.protected int
computeFernValueRand
(float c_x, float c_y, float rectWidth, float rectHeight, TldFernDescription fern) Computes the value of a fern after adding noise to the image being sampled.int
getMaxN()
int
getMaxP()
void
learnFern
(boolean positive, ImageRectangle r) Learns a fern from the specified region.void
learnFernNoise
(boolean positive, ImageRectangle r) Computes the value for each fern inside the region and update's their P and N value.boolean
For the specified regions, computes the values of each fern inside of it and then retrives their P and N values.void
Renormalizes fern.numN to avoid overflowvoid
Renormalizes fern.numP to avoid overflowvoid
reset()
Discard all information on fern values and their probabilitiesvoid
Call before any other functions.
-
Field Details
-
maxP
protected int maxP -
maxN
protected int maxN -
ferns
-
managers
-
-
Constructor Details
-
TldFernClassifier
public TldFernClassifier(Random rand, int numFerns, int descriptorSize, int numLearnRandom, float fernLearnNoise, InterpolatePixelS<T> interpolate) Configures fern algorithm- Parameters:
rand
- Random number generated used for creating fernsnumFerns
- Number of ferns to created. Typically 10descriptorSize
- Size of each fern's descriptor. Typically 10numLearnRandom
- Number of ferns which will be generated by adding noise to the imagefernLearnNoise
- The noise's standard deviationinterpolate
- Interpolation function for the image
-
TldFernClassifier
protected TldFernClassifier()
-
-
Method Details
-
reset
public void reset()Discard all information on fern values and their probabilities -
setImage
Call before any other functions. Provides the image that is being sampled.- Parameters:
gray
- Input image.
-
learnFern
Learns a fern from the specified region. No noise is added. -
learnFernNoise
Computes the value for each fern inside the region and update's their P and N value. Noise is added to the image measurements to take in account the variability. -
lookupFernPN
For the specified regions, computes the values of each fern inside of it and then retrives their P and N values. The sum of which is stored inside of info.- Parameters:
info
- (Input) Location/Rectangle (output) P and N values- Returns:
- true if a known value for any of the ferns was observed in this region
-
computeFernValue
protected int computeFernValue(float c_x, float c_y, float rectWidth, float rectHeight, TldFernDescription fern) Computes the value of the specified fern at the specified location in the image. -
computeFernValueRand
protected int computeFernValueRand(float c_x, float c_y, float rectWidth, float rectHeight, TldFernDescription fern) Computes the value of a fern after adding noise to the image being sampled. -
renormalizeP
public void renormalizeP()Renormalizes fern.numP to avoid overflow -
renormalizeN
public void renormalizeN()Renormalizes fern.numN to avoid overflow -
getMaxP
public int getMaxP() -
getMaxN
public int getMaxN()
-