public class SATWindowedExtractor extends Object implements WindowedHistogramExtractor
WindowedHistogramExtractor
with the primary
purpose of of producing efficient access to histograms of arbitrary windows
of the image.
This implementation is based on a stack of SummedAreaTable
s, with one
SummedAreaTable
per histogram bin. Obviously this is quite memory
intensive, so should probably only be used with small numbers of bins.
However, the advantage over a BinnedWindowedExtractor
is that the
histogram extraction is an O(1) operation, and it is thus very quick for
evaluating many windows.
Modifier and Type | Field and Description |
---|---|
protected int |
nbins |
protected SummedAreaTable[] |
sats |
Modifier | Constructor and Description |
---|---|
|
SATWindowedExtractor(FImage[] magnitudeMaps)
Construct with the given spatial histogram magnitude maps.
|
protected |
SATWindowedExtractor(int nbins)
Protected constructor for subclasses to use if they don't wan't to
compute the SATs at construction time
|
Modifier and Type | Method and Description |
---|---|
Histogram |
computeHistogram(int x,
int y,
int w,
int h)
Compute the histogram for the given window.
|
void |
computeHistogram(int x,
int y,
int w,
int h,
Histogram hist)
Compute the histogram for the given window, storing the output in the
given
Histogram object, which must have the same length as given
by WindowedHistogramExtractor.getNumBins() . |
Histogram |
computeHistogram(Rectangle roi)
Compute the histogram for the given window.
|
void |
computeHistogram(Rectangle roi,
Histogram histogram)
Compute the histogram for the given window, storing the output in the
given
Histogram object, which must have the same length as given
by WindowedHistogramExtractor.getNumBins() . |
protected void |
computeSATs(FImage[] magnitudeMaps) |
int |
getNumBins()
Get the number of bins
|
protected final SummedAreaTable[] sats
protected final int nbins
protected SATWindowedExtractor(int nbins)
nbins
- the number of histogram bins.public SATWindowedExtractor(FImage[] magnitudeMaps)
magnitudeMaps
- array of images, one per bin, with each pixel set to the
histogram magnitude at that binprotected void computeSATs(FImage[] magnitudeMaps)
public int getNumBins()
WindowedHistogramExtractor
getNumBins
in interface WindowedHistogramExtractor
public Histogram computeHistogram(Rectangle roi)
WindowedHistogramExtractor
computeHistogram
in interface WindowedHistogramExtractor
roi
- the windowpublic Histogram computeHistogram(int x, int y, int w, int h)
WindowedHistogramExtractor
computeHistogram
in interface WindowedHistogramExtractor
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 void computeHistogram(int x, int y, int w, int h, Histogram hist)
WindowedHistogramExtractor
Histogram
object, which must have the same length as given
by WindowedHistogramExtractor.getNumBins()
.computeHistogram
in interface WindowedHistogramExtractor
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 windowhist
- the histogram to write topublic void computeHistogram(Rectangle roi, Histogram histogram)
WindowedHistogramExtractor
Histogram
object, which must have the same length as given
by WindowedHistogramExtractor.getNumBins()
.computeHistogram
in interface WindowedHistogramExtractor
roi
- the windowhistogram
- the histogram to write to