public class SimpleBlockStrategy extends Object implements SpatialBinningStrategy
SpatialBinningStrategy
that extracts histograms from a number of
equally-sized, non-overlapping within the sample region and concatenates them
together. Each sub-histogram is L2 normalised.Constructor and Description |
---|
SimpleBlockStrategy(int numBlocks)
Construct with the given number of blocks in both the x and y directions.
|
SimpleBlockStrategy(int numBlocksX,
int numBlocksY)
Construct with the given number of blocks in the x and y directions.
|
Modifier and Type | Method and Description |
---|---|
Histogram |
extract(WindowedHistogramExtractor binnedData,
Rectangle region,
Histogram output)
Extract a histogram describing image content in the given region using
the given
WindowedHistogramExtractor to extract (sub) histograms
from which to build the output. |
public SimpleBlockStrategy(int numBlocks)
numBlocks
- number of blocks in each directionpublic SimpleBlockStrategy(int numBlocksX, int numBlocksY)
numBlocksX
- number of blocks in the x directionsnumBlocksY
- number of blocks in the y directionspublic Histogram extract(WindowedHistogramExtractor binnedData, Rectangle region, Histogram output)
SpatialBinningStrategy
WindowedHistogramExtractor
to extract (sub) histograms
from which to build the output.
For efficiency, this method allows the output histogram to be specified
as an input. This means that implementors of this interface can attempt
to fill the output histogram rather than creating a new instance
(although care should be taken to ensure that the porivded output
histogram is the correct size and not null
).
Users of SpatialBinningStrategy
s should use the following style
for maximum efficiency:
Histogram h = null;
...
for (Rectangle region : lots_of_regions)
h = strategy.extract(binnedData, region, h);
extract
in interface SpatialBinningStrategy
binnedData
- the WindowedHistogramExtractor
to extract
sub-histograms fromregion
- the region to extract fromoutput
- the output histogram to fill (can be null)output
)