public class ThresholdBlockOtsu extends java.lang.Object implements ThresholdBlock.BlockProcessor<boofcv.struct.image.GrayU8,boofcv.struct.image.InterleavedS32>
ThresholdBlock. Computes a histogram in non-overlapping
square regions. Then thresholds a single region by combining histograms from its neighbors to make it less blocky.
This implementation includes a modification from the traditional Otsu algorithm. The threshold can optionally
be adjusted in low variance regions. See code for details.
NOTE: This produces visually different results from ThresholdBlockOtsu because the block algorithm
combines histograms from its neighboring blocks. That's why it appears to have a wider effective block.
| Modifier and Type | Field and Description |
|---|---|
protected int |
blockHeight |
protected int |
blockWidth |
protected boolean |
thresholdFromLocalBlocks |
| Constructor and Description |
|---|
ThresholdBlockOtsu(boolean otsu2,
double tuning,
double scale,
boolean down)
Configures the detector
|
| Modifier and Type | Method and Description |
|---|---|
void |
computeBlockStatistics(int x0,
int y0,
int width,
int height,
int indexStats,
boofcv.struct.image.GrayU8 input,
boofcv.struct.image.InterleavedS32 stats)
Computes the min-max value inside a block
|
ThresholdBlock.BlockProcessor<boofcv.struct.image.GrayU8,boofcv.struct.image.InterleavedS32> |
copy()
Creates a copy.
|
boofcv.struct.image.InterleavedS32 |
createStats() |
void |
init(int blockWidth,
int blockHeight,
boolean thresholdFromLocalBlocks) |
void |
thresholdBlock(int blockX0,
int blockY0,
boofcv.struct.image.GrayU8 input,
boofcv.struct.image.InterleavedS32 stats,
boofcv.struct.image.GrayU8 output)
Thresholds all the pixels inside the specified block
|
protected int blockWidth
protected int blockHeight
protected boolean thresholdFromLocalBlocks
public ThresholdBlockOtsu(boolean otsu2,
double tuning,
double scale,
boolean down)
tuning - Tuning parameter. 0 = standard Otsu. Greater than 0 will penalize zero texture.public boofcv.struct.image.InterleavedS32 createStats()
createStats in interface ThresholdBlock.BlockProcessor<boofcv.struct.image.GrayU8,boofcv.struct.image.InterleavedS32>public void init(int blockWidth,
int blockHeight,
boolean thresholdFromLocalBlocks)
init in interface ThresholdBlock.BlockProcessor<boofcv.struct.image.GrayU8,boofcv.struct.image.InterleavedS32>public void computeBlockStatistics(int x0,
int y0,
int width,
int height,
int indexStats,
boofcv.struct.image.GrayU8 input,
boofcv.struct.image.InterleavedS32 stats)
ThresholdBlock.BlockProcessorcomputeBlockStatistics in interface ThresholdBlock.BlockProcessor<boofcv.struct.image.GrayU8,boofcv.struct.image.InterleavedS32>x0 - lower bound pixel value of block, x-axisy0 - upper bound pixel value of block, y-axiswidth - Block's widthheight - Block's heightindexStats - array index of statistics image pixelinput - Input imagepublic void thresholdBlock(int blockX0,
int blockY0,
boofcv.struct.image.GrayU8 input,
boofcv.struct.image.InterleavedS32 stats,
boofcv.struct.image.GrayU8 output)
ThresholdBlock.BlockProcessorthresholdBlock in interface ThresholdBlock.BlockProcessor<boofcv.struct.image.GrayU8,boofcv.struct.image.InterleavedS32>blockX0 - Block x-coordinateblockY0 - Block y-coordinateinput - Input imageoutput - Output imagepublic ThresholdBlock.BlockProcessor<boofcv.struct.image.GrayU8,boofcv.struct.image.InterleavedS32> copy()
ThresholdBlock.BlockProcessorcopy in interface ThresholdBlock.BlockProcessor<boofcv.struct.image.GrayU8,boofcv.struct.image.InterleavedS32>