T
- value type of the input image.public final class MserTree<T extends Type<T>> extends Object implements ComponentForest<Mser<T>>, Iterable<Mser<T>>, PartialComponent.Handler<net.imglib2.algorithm.componenttree.mser.MserPartialComponent<T>>
PixelListComponent
s. This
class is used both to represent and build the tree. For building the tree
PartialComponent.Handler
is implemented to gather
MserPartialComponent
emitted by BuildComponentTree
.
Maximally Stable Extremal Regions (MSER) are selected from the component tree as follows. For each component, an instability score is computed as
\[\frac{|R_i - R_{i-\Delta}|}{|R_i|}\]
Regions whose score is a local minimum are selected as MSER candidates.
A candidate region is discarded if its size (number of pixels) is smaller than minSize or larger than maxSize. A candidate region is discarded if its instability score is greater than maxVar.
A tree is build of the remaining candidates. Finally, candidates are pruned from the tree, if they are too similar to their parent: Let A, B be a region and its parent. Then A is discarded if
\[\frac{|B - A|}{|B|} \leq minDiversity\]
TODO Add support for non-zero-min RandomAccessibleIntervals. (Currently, we assume that the input image is a zero-min interval.)
Modifier and Type | Method and Description |
---|---|
static <T extends Type<T>> |
buildMserTree(RandomAccessibleInterval<T> input,
ComputeDelta<T> computeDelta,
long minSize,
long maxSize,
double maxVar,
double minDiversity,
ImgFactory<LongType> imgFactory,
T maxValue,
Comparator<T> comparator)
Build a MSER tree from an input image.
|
static <T extends Type<T>> |
buildMserTree(RandomAccessibleInterval<T> input,
ComputeDelta<T> computeDelta,
long minSize,
long maxSize,
double maxVar,
double minDiversity,
T maxValue,
Comparator<T> comparator)
Build a MSER tree from an input image.
|
static <T extends RealType<T>> |
buildMserTree(RandomAccessibleInterval<T> input,
double delta,
long minSize,
long maxSize,
double maxVar,
double minDiversity,
boolean darkToBright)
Build a MSER tree from an input image.
|
static <T extends RealType<T>> |
buildMserTree(RandomAccessibleInterval<T> input,
T delta,
long minSize,
long maxSize,
double maxVar,
double minDiversity,
boolean darkToBright)
Build a MSER tree from an input image.
|
static <T extends RealType<T>> |
buildMserTree(RandomAccessibleInterval<T> input,
T delta,
long minSize,
long maxSize,
double maxVar,
double minDiversity,
ImgFactory<LongType> imgFactory,
boolean darkToBright)
Build a MSER tree from an input image.
|
void |
emit(net.imglib2.algorithm.componenttree.mser.MserPartialComponent<T> component)
BuildComponentTree calls this for every completed component. |
Iterator<Mser<T>> |
iterator()
Returns an iterator over all MSERs in the tree.
|
HashSet<Mser<T>> |
roots()
Get the set of roots of the MSER tree (respectively forest...).
|
int |
size()
Get number of detected MSERs.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static <T extends RealType<T>> MserTree<T> buildMserTree(RandomAccessibleInterval<T> input, double delta, long minSize, long maxSize, double maxVar, double minDiversity, boolean darkToBright)
buildMserTree(RandomAccessibleInterval, RealType, long, long, double, double, ImgFactory, boolean)
using an ArrayImgFactory
or CellImgFactory
depending on
input image size.input
- the input image.delta
- delta for computing instability score.minSize
- minimum size (in pixels) of accepted MSER.maxSize
- maximum size (in pixels) of accepted MSER.maxVar
- maximum instability score of accepted MSER.minDiversity
- minimal diversity of adjacent accepted MSER.darkToBright
- whether to apply thresholds from dark to bright (true) or
bright to dark (false)public static <T extends RealType<T>> MserTree<T> buildMserTree(RandomAccessibleInterval<T> input, T delta, long minSize, long maxSize, double maxVar, double minDiversity, boolean darkToBright)
buildMserTree(RandomAccessibleInterval, RealType, long, long, double, double, ImgFactory, boolean)
using an ArrayImgFactory
or CellImgFactory
depending on
input image size.input
- the input image.delta
- delta for computing instability score.minSize
- minimum size (in pixels) of accepted MSER.maxSize
- maximum size (in pixels) of accepted MSER.maxVar
- maximum instability score of accepted MSER.minDiversity
- minimal diversity of adjacent accepted MSER.darkToBright
- whether to apply thresholds from dark to bright (true) or
bright to dark (false)public static <T extends RealType<T>> MserTree<T> buildMserTree(RandomAccessibleInterval<T> input, T delta, long minSize, long maxSize, double maxVar, double minDiversity, ImgFactory<LongType> imgFactory, boolean darkToBright)
input
- the input image.delta
- delta for computing instability score.minSize
- minimum size (in pixels) of accepted MSER.maxSize
- maximum size (in pixels) of accepted MSER.maxVar
- maximum instability score of accepted MSER.minDiversity
- minimal diversity of adjacent accepted MSER.imgFactory
- used for creating the PixelList
imagedarkToBright
- whether to apply thresholds from dark to bright (true) or
bright to dark (false)MserPartialComponentGenerator
public static <T extends Type<T>> MserTree<T> buildMserTree(RandomAccessibleInterval<T> input, ComputeDelta<T> computeDelta, long minSize, long maxSize, double maxVar, double minDiversity, T maxValue, Comparator<T> comparator)
buildMserTree(RandomAccessibleInterval, ComputeDelta, long, long, double, double, ImgFactory, Type, Comparator)
using an ArrayImgFactory
or CellImgFactory
depending on
input image size.input
- the input image.computeDelta
- to compute (value - delta).minSize
- minimum size (in pixels) of accepted MSER.maxSize
- maximum size (in pixels) of accepted MSER.maxVar
- maximum instability score of accepted MSER.minDiversity
- minimal diversity of adjacent accepted MSER.maxValue
- a value (e.g., grey-level) greater than any occurring in the
input image.comparator
- determines ordering of threshold values.public static <T extends Type<T>> MserTree<T> buildMserTree(RandomAccessibleInterval<T> input, ComputeDelta<T> computeDelta, long minSize, long maxSize, double maxVar, double minDiversity, ImgFactory<LongType> imgFactory, T maxValue, Comparator<T> comparator)
input
- the input image.computeDelta
- to compute (value - delta).minSize
- minimum size (in pixels) of accepted MSER.maxSize
- maximum size (in pixels) of accepted MSER.maxVar
- maximum instability score of accepted MSER.minDiversity
- minimal diversity of adjacent accepted MSER.imgFactory
- used for creating the PixelList
imagemaxValue
- a value (e.g., grey-level) greater than any occurring in the
input image.comparator
- determines ordering of threshold values.MserPartialComponentGenerator
public void emit(net.imglib2.algorithm.componenttree.mser.MserPartialComponent<T> component)
PartialComponent.Handler
BuildComponentTree
calls this for every completed component.
NOTE THAT THE COMPONENT IS RE-USED BY BuildComponentTree
!
That is, after calling emit() new pixels may be added, etc. Do not
store the component object but rather copy the relevant data!emit
in interface PartialComponent.Handler<net.imglib2.algorithm.componenttree.mser.MserPartialComponent<T extends Type<T>>>
component
- a completed componentpublic int size()
Copyright © 2015–2022 ImgLib2. All rights reserved.