Package boofcv.alg.tracker.meanshift
Class LocalWeightedHistogramRotRect<T extends ImageBase<T>>
java.lang.Object
boofcv.alg.tracker.meanshift.LocalWeightedHistogramRotRect<T>
Computes a local histogram weighted using a Gaussian function. The weighting function is shaped using a rotated
rectangle, where the sigma along each axis is set by the rectangle's width and height. For use with
TrackerMeanShiftComaniciu2003
.
The histogram is stored in a row major format.-
Field Summary
Modifier and TypeFieldDescriptionprotected float
protected float[]
float
float
protected float
protected float
protected int[]
protected List<Point2D_F32>
protected float[]
-
Constructor Summary
ConstructorDescriptionLocalWeightedHistogramRotRect
(int numSamples, double numSigmas, int numHistogramBins, int numBands, float maxPixelValue, InterpolatePixelMB<T> interpolate) Configures histogram calculation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
computeHistogram
(T image, RectangleRotate_F32 region) Computes the histogram inside the specified region.protected int
computeHistogramBin
(float[] value) Given the value of a pixel, compute which bin in the histogram it belongs inprotected void
computeHistogramBorder
(T image, RectangleRotate_F32 region) Computes the histogram and skips pixels which are outside the image borderprotected void
Computes the histogram quickly inside the imageprotected void
computeWeights
(int numSamples, double numSigmas) compute the weights by convolving 1D gaussian kernelprotected void
createSamplePoints
(int numSamples) create the list of points in square coordinates that it will sample.float[]
int[]
protected boolean
isInFastBounds
(RectangleRotate_F32 region) Checks to see if the region can be sampled using the fast algorithmprotected void
protected void
squareToImageSample
(float x, float y, RectangleRotate_F32 region) Converts a point from square coordinates into image coordinates
-
Field Details
-
maxPixelValue
protected float maxPixelValue -
c
protected float c -
s
protected float s -
imageX
public float imageX -
imageY
public float imageY -
sampleHistIndex
protected int[] sampleHistIndex -
weights
protected float[] weights -
histogram
protected float[] histogram -
samplePts
-
-
Constructor Details
-
LocalWeightedHistogramRotRect
public LocalWeightedHistogramRotRect(int numSamples, double numSigmas, int numHistogramBins, int numBands, float maxPixelValue, InterpolatePixelMB<T> interpolate) Configures histogram calculation.- Parameters:
numSamples
- Number of points it samples along each axis of the rectangle.numSigmas
- Number of standard deviations away the sides will be from the center. Try 3numHistogramBins
- Number of bins in the histogramnumBands
- Number of bands in the input imagemaxPixelValue
- Maximum value of a pixel across all bandsinterpolate
- Function used to interpolate the image
-
-
Method Details
-
computeWeights
protected void computeWeights(int numSamples, double numSigmas) compute the weights by convolving 1D gaussian kernel -
createSamplePoints
protected void createSamplePoints(int numSamples) create the list of points in square coordinates that it will sample. values will range from -0.5 to 0.5 along each axis. -
computeHistogram
Computes the histogram inside the specified region. Results are returned by callinggetHistogram()
.- Parameters:
image
- Input imageregion
- Region which is to be sampled
-
computeHistogramInside
Computes the histogram quickly inside the image -
computeHistogramBorder
Computes the histogram and skips pixels which are outside the image border -
computeHistogramBin
protected int computeHistogramBin(float[] value) Given the value of a pixel, compute which bin in the histogram it belongs in -
isInFastBounds
Checks to see if the region can be sampled using the fast algorithm -
normalizeHistogram
protected void normalizeHistogram() -
squareToImageSample
Converts a point from square coordinates into image coordinates -
getHistogram
public float[] getHistogram() -
getSampleHistIndex
public int[] getSampleHistIndex() -
getSamplePts
-