public class FlexibleHOGStrategy extends Object implements SpatialBinningStrategy
SpatialBinningStrategy
very much like the FixedHOGStrategy
,
but with flexibly sized cells that grow/shrink such that the number of cells
in any given window is constant. Coupled with a
GradientOrientationHistogramExtractor
, this provides a way to
efficiently extract the HOG descriptor of any rectangular window.Constructor and Description |
---|
FlexibleHOGStrategy(int numCellsX,
int numCellsY,
int cellsPerBlock)
Construct with the given number of cells per window (or image).
|
FlexibleHOGStrategy(int numCellsX,
int numCellsY,
int cellsPerBlock,
FixedHOGStrategy.BlockNormalisation norm)
Construct with the given number of cells per window (or image).
|
FlexibleHOGStrategy(int numCellsX,
int numCellsY,
int cellsPerBlock,
int blockStep,
FixedHOGStrategy.BlockNormalisation norm)
Construct with the given number of cells per window (or image).
|
FlexibleHOGStrategy(int numCellsX,
int numCellsY,
int cellsPerBlockX,
int cellsPerBlockY,
int blockStepX,
int blockStepY,
FixedHOGStrategy.BlockNormalisation norm)
Construct with the given number of cells per window (or image).
|
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 FlexibleHOGStrategy(int numCellsX, int numCellsY, int cellsPerBlock)
FixedHOGStrategy.BlockNormalisation.L2
is used for block normalisation.numCellsX
- the number of cells per window in the x directionnumCellsY
- the number of cells per window in the y directioncellsPerBlock
- the number of cells per blockpublic FlexibleHOGStrategy(int numCellsX, int numCellsY, int cellsPerBlock, FixedHOGStrategy.BlockNormalisation norm)
numCellsX
- the number of cells per window in the x directionnumCellsY
- the number of cells per window in the y directioncellsPerBlock
- the number of cells per blocknorm
- the normalisation schemepublic FlexibleHOGStrategy(int numCellsX, int numCellsY, int cellsPerBlock, int blockStep, FixedHOGStrategy.BlockNormalisation norm)
numCellsX
- the number of cells per window in the x directionnumCellsY
- the number of cells per window in the y directioncellsPerBlock
- the number of cells per blockblockStep
- the amount to shift each block in terms of cellsnorm
- the normalisation schemepublic FlexibleHOGStrategy(int numCellsX, int numCellsY, int cellsPerBlockX, int cellsPerBlockY, int blockStepX, int blockStepY, FixedHOGStrategy.BlockNormalisation norm)
numCellsX
- the number of cells per window in the x directionnumCellsY
- the number of cells per window in the y directioncellsPerBlockX
- the number of cells per block in the x directioncellsPerBlockY
- the number of cells per block in the y directionblockStepX
- the amount to shift each block in terms of cells in the x
directionblockStepY
- the amount to shift each block in terms of cells in the y
directionnorm
- the normalisation schemepublic 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
)