public class BasicSkeletonPixelClassifier2D extends ApertureBasedSkeletonPixelClassifier
Ready classifier of pixel of 2-dimensional thinning skeletons
.
There are only 3 instances of this class, returned by the methods:
getOctupleThinningInstance()
,getQuadruple3x5ThinningInstance()
,getStrongQuadruple3x5ThinningInstance()
.These classifiers are designed for processing bit matrices, which are the final results of
most popular 2-dimensional skeletonization algorithms: OctupleThinningSkeleton2D
,
Quadruple3x5ThinningSkeleton2D
and StrongQuadruple3x5ThinningSkeleton2D
.
These algorithms have different "strength", so, using "stronger" classifier for "weaker" skeleton
(for example, using getStrongQuadruple3x5ThinningInstance()
for the resulting skeleton
of OctupleThinningSkeleton2D
algorithm) can lead to recognition of some skeleton pixels as
"illegal
".
This class is immutable and thread-safe: there are no ways to modify settings of the created instance.
SkeletonPixelClassifier.AttachmentInformation
Modifier and Type | Field and Description |
---|---|
static int |
NEIGHBOUR_INDEX_MAX
7: maximal non-negative value, that can be returned by
asPixelTypes method
in this class. |
static int |
NEIGHBOUR_INDEX_MIN
0: minimal non-negative value, that can be returned by
asPixelTypes method
in this class. |
static int |
NEIGHBOUR_INDEX_XM
7: an index of the neighbour #7 of any element in terms of
neighbourOffset(int) method. |
static int |
NEIGHBOUR_INDEX_XM_YM
0: an index of the neighbour #0 of any element in terms of
neighbourOffset(int) method. |
static int |
NEIGHBOUR_INDEX_XM_YP
6: an index of the neighbour #6 of any element in terms of
neighbourOffset(int) method. |
static int |
NEIGHBOUR_INDEX_XP
3: an index of the neighbour #3 of any element in terms of
neighbourOffset(int) method. |
static int |
NEIGHBOUR_INDEX_XP_YM
2: an index of the neighbour #2 of any element in terms of
neighbourOffset(int) method. |
static int |
NEIGHBOUR_INDEX_XP_YP
4: an index of the neighbour #4 of any element in terms of
neighbourOffset(int) method. |
static int |
NEIGHBOUR_INDEX_YM
1: an index of the neighbour #1 of any element in terms of
neighbourOffset(int) method. |
static int |
NEIGHBOUR_INDEX_YP
5: an index of the neighbour #5 of any element in terms of
neighbourOffset(int) method. |
dimCount, numberOfNeighbours, TYPE_BRANCH_MAX, TYPE_BRANCH_MIN, TYPE_FREE_BRANCH_END, TYPE_ILLEGAL, TYPE_ISOLATED, TYPE_NODE_OR_BRANCH_END_MAX, TYPE_NODE_OR_BRANCH_END_MIN, TYPE_USUAL_BRANCH, TYPE_USUAL_NODE, TYPE_ZERO
Modifier and Type | Method and Description |
---|---|
static BasicSkeletonPixelClassifier2D |
getOctupleThinningInstance()
Returns the instance of this class, intended for processing skeletons, which are
the final result of skeletonization by
OctupleThinningSkeleton2D algorithm. |
static BasicSkeletonPixelClassifier2D |
getQuadruple3x5ThinningInstance()
Returns the instance of this class, intended for processing skeletons, which are
the final result of skeletonization by
Quadruple3x5ThinningSkeleton2D algorithm. |
static BasicSkeletonPixelClassifier2D |
getStrongQuadruple3x5ThinningInstance()
Returns the instance of this class, intended for processing skeletons, which are
the final result of skeletonization by
StrongQuadruple3x5ThinningSkeleton2D algorithm. |
protected int |
pixelTypeOrAttachedNode(int apertureBits)
Calculates and returns the value of an element C'
in the resulting matrix, produced by
asPixelTypes method with
NEIGHBOUR_INDEX_OF_ATTACHED_NODE value of attachmentInformation argument,
on the base of bit values of all neighbours (in terms of the
straight-and-diagonal connectivity kind )
of the corresponding unit element C in the source skeleton bit matrix. |
protected int |
pixelTypeOrAttachingBranch(int apertureBits)
Calculates and returns the value of an element C'
in the resulting matrix, produced by
asPixelTypes method with
NEIGHBOUR_INDEX_OF_ATTACHING_BRANCH value of attachmentInformation argument,
on the base of bit values of all neighbours (in terms of the
straight-and-diagonal connectivity kind )
of the corresponding unit element C in the source skeleton bit matrix. |
asNeighbourhoodBitMaps, asPixelTypes, markNeighbouringNodesNotConnectedViaDegeneratedBranches, neighbourOffset, reverseNeighbourIndex
dimCount, isAttachableBranchEndPixelType, isBranchPixelType, isFreeBranchEndPixelType, isIllegalPixelType, isNodeOrFreeBranchEndPixelType, isNodePixelType, isUsualBranchPixelType, neighbourOffset, numberOfNeighbours
public static final int NEIGHBOUR_INDEX_XM_YM
neighbourOffset(int)
method.
It is one of possible non-negative values, returned by asPixelTypes
method.
You can understand the sense of the name of this constant from the comments to these methods.public static final int NEIGHBOUR_INDEX_YM
neighbourOffset(int)
method.
It is one of possible non-negative values, returned by asPixelTypes
method.
You can understand the sense of the name of this constant from the comments to these methods.public static final int NEIGHBOUR_INDEX_XP_YM
neighbourOffset(int)
method.
It is one of possible non-negative values, returned by asPixelTypes
method.
You can understand the sense of the name of this constant from the comments to these methods.public static final int NEIGHBOUR_INDEX_XP
neighbourOffset(int)
method.
It is one of possible non-negative values, returned by asPixelTypes
method.
You can understand the sense of the name of this constant from the comments to these methods.public static final int NEIGHBOUR_INDEX_XP_YP
neighbourOffset(int)
method.
It is one of possible non-negative values, returned by asPixelTypes
method.
You can understand the sense of the name of this constant from the comments to these methods.public static final int NEIGHBOUR_INDEX_YP
neighbourOffset(int)
method.
It is one of possible non-negative values, returned by asPixelTypes
method.
You can understand the sense of the name of this constant from the comments to these methods.public static final int NEIGHBOUR_INDEX_XM_YP
neighbourOffset(int)
method.
It is one of possible non-negative values, returned by asPixelTypes
method.
You can understand the sense of the name of this constant from the comments to these methods.public static final int NEIGHBOUR_INDEX_XM
neighbourOffset(int)
method.
It is one of possible non-negative values, returned by asPixelTypes
method.
You can understand the sense of the name of this constant from the comments to these methods.public static final int NEIGHBOUR_INDEX_MIN
asPixelTypes
method
in this class.public static final int NEIGHBOUR_INDEX_MAX
asPixelTypes
method
in this class.public static BasicSkeletonPixelClassifier2D getOctupleThinningInstance()
OctupleThinningSkeleton2D
algorithm.OctupleThinningSkeleton2D
skeletons.public static BasicSkeletonPixelClassifier2D getQuadruple3x5ThinningInstance()
Quadruple3x5ThinningSkeleton2D
algorithm.Quadruple3x5ThinningSkeleton2D
skeletons.public static BasicSkeletonPixelClassifier2D getStrongQuadruple3x5ThinningInstance()
StrongQuadruple3x5ThinningSkeleton2D
algorithm.StrongQuadruple3x5ThinningSkeleton2D
skeletons.protected int pixelTypeOrAttachingBranch(int apertureBits)
ApertureBasedSkeletonPixelClassifier
asPixelTypes
method with
NEIGHBOUR_INDEX_OF_ATTACHING_BRANCH
value of attachmentInformation argument,
on the base of bit values of all neighbours (in terms of the
straight-and-diagonal connectivity kind
)
of the corresponding unit element C in the source skeleton bit matrix.
More precisely, the bit values of the neighbours of this skeleton element C
are passed via the low
m=numberOfNeighbours()
bits of apertureBits argument.
The bit #k of this argument, 0≤k<m (its value is
neighbourOffset(int)
method.
In particular, in BasicSkeletonPixelClassifier2D
implementation,
the order of neighbours is described by the following diagram:
0 1 2 7 C 3 6 5 4
So, 8 low bits of apertureBits contain the values of the corresponding neighbouring elements in anticlockwise order (the x-axis is directed rightward, the y-axis is directed downward).
It is supposed that the central element (C) of the skeleton is unit
(for zero elements ot the skeleton matrix, asPixelTypes
method of
this class returns SkeletonPixelClassifier.TYPE_ZERO
without calling this method).
Note, that the situation, when the neighbouring elements are out of ranges of the matrix coordinates,
is processed according to the model of infinite pseudo-cyclical continuation —
see the end of the comments to SkeletonPixelClassifier
.
pixelTypeOrAttachingBranch
in class ApertureBasedSkeletonPixelClassifier
apertureBits
- the values of all 8 neighbours of the current unit element of the source skeleton
bit matrix.protected int pixelTypeOrAttachedNode(int apertureBits)
ApertureBasedSkeletonPixelClassifier
asPixelTypes
method with
NEIGHBOUR_INDEX_OF_ATTACHED_NODE
value of attachmentInformation argument,
on the base of bit values of all neighbours (in terms of the
straight-and-diagonal connectivity kind
)
of the corresponding unit element C in the source skeleton bit matrix.
More precisely, the bit values of the neighbours of this skeleton element C
are passed via the low
m=numberOfNeighbours()
bits of apertureBits argument.
The bit #k of this argument, 0≤k<m (its value is
neighbourOffset(int)
method.
In particular, in BasicSkeletonPixelClassifier2D
implementation,
the order of neighbours is described by the following diagram:
0 1 2 7 C 3 6 5 4
So, 8 low bits of apertureBits contain the values of the corresponding neighbouring elements in anticlockwise order (the x-axis is directed rightward, the y-axis is directed downward).
It is supposed that the central element (C) of the skeleton is unit
(for zero elements ot the skeleton matrix, asPixelTypes
method of
this class returns SkeletonPixelClassifier.TYPE_ZERO
without calling this method).
Note, that the situation, when the neighbouring elements are out of ranges of the matrix coordinates,
is processed according to the model of infinite pseudo-cyclical continuation —
see the end of the comments to SkeletonPixelClassifier
.
pixelTypeOrAttachedNode
in class ApertureBasedSkeletonPixelClassifier
apertureBits
- the values of all 8 neighbours of the current unit element of the source skeleton
bit matrix.