public class InterpolatedBinnedWindowedExtractor extends BinnedWindowedExtractor
InterpolatedBinnedWindowedExtractor
is an extension to a
BinnedWindowedExtractor
that performs soft assignment to the
histogram bins through linear interpolation. If a point being histogrammed
lies directly between two bins, half of its weight will be added to both
bins. If a point is directly in the centre of a bin, then its full weight
will be added to both bins. All other cases use linear interpolation to
distribute the weight across the two nearest bins.
Cyclic histograms are also supported (i.e. for angles).
For non cyclic histograms, the bin centres are at min + binWidth/2 +
n*binWidth
for n=0..<nbins
. Any point less than
binWidth/2
from the end of a non-cyclic histogram counts fully
to the respective end bin.
For cyclic histograms, the bin centres are at min + n*binWidth
for n=0..<nbins
.
binMap, max, min, nbins
Constructor and Description |
---|
InterpolatedBinnedWindowedExtractor(int nbins)
Construct with the given number of bins.
|
InterpolatedBinnedWindowedExtractor(int nbins,
boolean wrap)
Construct with the given number of bins.
|
InterpolatedBinnedWindowedExtractor(int nbins,
float min,
float max)
Construct with the given number of bins, and range.
|
InterpolatedBinnedWindowedExtractor(int nbins,
float min,
float max,
boolean wrap)
Construct with the given number of bins, and range.
|
Modifier and Type | Method and Description |
---|---|
void |
analyseImage(FImage image)
Computes the bin-map for this image.
|
Histogram |
computeHistogram(int x,
int y,
FImage extWeights,
FImage windowWeights)
Compute the histogram for the given window.
|
Histogram |
computeHistogram(int x,
int y,
int w,
int h)
Compute the histogram for the given window.
|
Histogram |
computeHistogram(int x,
int y,
int w,
int h,
FImage extWeights)
Compute the histogram for the given window.
|
float[][] |
getWeightsMap()
Get the weights map
|
computeHistogram, computeHistogram, computeHistogram, computeHistogram, getBinMap, getMax, getMin, getNumBins, setMax, setMin, setNbins
public InterpolatedBinnedWindowedExtractor(int nbins)
nbins
- number of binspublic InterpolatedBinnedWindowedExtractor(int nbins, boolean wrap)
nbins
- number of binswrap
- true if the histogram is cyclic; false otherwisepublic InterpolatedBinnedWindowedExtractor(int nbins, float min, float max)
nbins
- number of binsmin
- minimum expected valuemax
- maximum expected valuepublic InterpolatedBinnedWindowedExtractor(int nbins, float min, float max, boolean wrap)
nbins
- number of binsmin
- minimum expected valuemax
- maximum expected valuewrap
- true if the histogram is cyclic; false otherwisepublic void analyseImage(FImage image)
analyseImage
in interface ImageAnalyser<FImage>
analyseImage
in class BinnedWindowedExtractor
image
- The image to process in place.public Histogram computeHistogram(int x, int y, int w, int h)
WindowedHistogramExtractor
computeHistogram
in interface WindowedHistogramExtractor
computeHistogram
in class BinnedWindowedExtractor
x
- The x-coordinate of the top-left of the windowy
- The y-coordinate of the top-left of the windoww
- The width of the windowh
- The height of the windowpublic Histogram computeHistogram(int x, int y, int w, int h, FImage extWeights)
BinnedWindowedExtractor
computeHistogram
in class BinnedWindowedExtractor
x
- The x-coordinate of the top-left of the windowy
- The y-coordinate of the top-left of the windoww
- The width of the windowh
- The height of the windowextWeights
- the weights image. Must be the same size as the analysed
image.public Histogram computeHistogram(int x, int y, FImage extWeights, FImage windowWeights)
BinnedWindowedExtractor
This method primarily allows you to compute a spatially weighted histogram. For example, the window weights image could be a 2D Gaussian, and thus the histogram would apply more weight on to the centre pixels.
computeHistogram
in class BinnedWindowedExtractor
x
- The x-coordinate of the top-left of the windowy
- The y-coordinate of the top-left of the windowextWeights
- The weights image. Must be the same size as the analysed
image.windowWeights
- The weights for each pixel in the window.public float[][] getWeightsMap()