Class BasicSkeletonPixelClassifier2D
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.
- Author:
- Daniel Alievsky
-
Nested Class Summary
Nested classes/interfaces inherited from class net.algart.matrices.skeletons.SkeletonPixelClassifier
SkeletonPixelClassifier.AttachmentInformation
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
7: maximal non-negative value, that can be returned byasPixelTypes
method in this class.static final int
0: minimal non-negative value, that can be returned byasPixelTypes
method in this class.static final int
7: an index of the neighbour #7 of any element in terms ofneighbourOffset(int)
method.static final int
0: an index of the neighbour #0 of any element in terms ofneighbourOffset(int)
method.static final int
6: an index of the neighbour #6 of any element in terms ofneighbourOffset(int)
method.static final int
3: an index of the neighbour #3 of any element in terms ofneighbourOffset(int)
method.static final int
2: an index of the neighbour #2 of any element in terms ofneighbourOffset(int)
method.static final int
4: an index of the neighbour #4 of any element in terms ofneighbourOffset(int)
method.static final int
1: an index of the neighbour #1 of any element in terms ofneighbourOffset(int)
method.static final int
5: an index of the neighbour #5 of any element in terms ofneighbourOffset(int)
method.Fields inherited from class net.algart.matrices.skeletons.SkeletonPixelClassifier
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
-
Method Summary
Modifier and TypeMethodDescriptionReturns the instance of this class, intended for processing skeletons, which are the final result of skeletonization byOctupleThinningSkeleton2D
algorithm.Returns the instance of this class, intended for processing skeletons, which are the final result of skeletonization byQuadruple3x5ThinningSkeleton2D
algorithm.Returns the instance of this class, intended for processing skeletons, which are the final result of skeletonization byStrongQuadruple3x5ThinningSkeleton2D
algorithm.protected int
pixelTypeOrAttachedNode
(int apertureBits) Calculates and returns the value of an element C' in the resulting matrix, produced byasPixelTypes
method withNEIGHBOUR_INDEX_OF_ATTACHED_NODE
value of attachmentInformation argument, on the base of bit values of all neighbours (in terms of thestraight-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 byasPixelTypes
method withNEIGHBOUR_INDEX_OF_ATTACHING_BRANCH
value of attachmentInformation argument, on the base of bit values of all neighbours (in terms of thestraight-and-diagonal connectivity kind
) of the corresponding unit element C in the source skeleton bit matrix.Methods inherited from class net.algart.matrices.skeletons.ApertureBasedSkeletonPixelClassifier
asNeighbourhoodBitMaps, asPixelTypes, markNeighbouringNodesNotConnectedViaDegeneratedBranches, neighbourOffset, reverseNeighbourIndex
Methods inherited from class net.algart.matrices.skeletons.SkeletonPixelClassifier
dimCount, isAttachableBranchEndPixelType, isBranchPixelType, isFreeBranchEndPixelType, isIllegalPixelType, isNodeOrFreeBranchEndPixelType, isNodePixelType, isUsualBranchPixelType, neighbourOffset, numberOfNeighbours
-
Field Details
-
NEIGHBOUR_INDEX_XM_YM
public static final int NEIGHBOUR_INDEX_XM_YM0: an index of the neighbour #0 of any element in terms ofneighbourOffset(int)
method. It is one of possible non-negative values, returned byasPixelTypes
method. You can understand the sense of the name of this constant from the comments to these methods.- See Also:
-
NEIGHBOUR_INDEX_YM
public static final int NEIGHBOUR_INDEX_YM1: an index of the neighbour #1 of any element in terms ofneighbourOffset(int)
method. It is one of possible non-negative values, returned byasPixelTypes
method. You can understand the sense of the name of this constant from the comments to these methods.- See Also:
-
NEIGHBOUR_INDEX_XP_YM
public static final int NEIGHBOUR_INDEX_XP_YM2: an index of the neighbour #2 of any element in terms ofneighbourOffset(int)
method. It is one of possible non-negative values, returned byasPixelTypes
method. You can understand the sense of the name of this constant from the comments to these methods.- See Also:
-
NEIGHBOUR_INDEX_XP
public static final int NEIGHBOUR_INDEX_XP3: an index of the neighbour #3 of any element in terms ofneighbourOffset(int)
method. It is one of possible non-negative values, returned byasPixelTypes
method. You can understand the sense of the name of this constant from the comments to these methods.- See Also:
-
NEIGHBOUR_INDEX_XP_YP
public static final int NEIGHBOUR_INDEX_XP_YP4: an index of the neighbour #4 of any element in terms ofneighbourOffset(int)
method. It is one of possible non-negative values, returned byasPixelTypes
method. You can understand the sense of the name of this constant from the comments to these methods.- See Also:
-
NEIGHBOUR_INDEX_YP
public static final int NEIGHBOUR_INDEX_YP5: an index of the neighbour #5 of any element in terms ofneighbourOffset(int)
method. It is one of possible non-negative values, returned byasPixelTypes
method. You can understand the sense of the name of this constant from the comments to these methods.- See Also:
-
NEIGHBOUR_INDEX_XM_YP
public static final int NEIGHBOUR_INDEX_XM_YP6: an index of the neighbour #6 of any element in terms ofneighbourOffset(int)
method. It is one of possible non-negative values, returned byasPixelTypes
method. You can understand the sense of the name of this constant from the comments to these methods.- See Also:
-
NEIGHBOUR_INDEX_XM
public static final int NEIGHBOUR_INDEX_XM7: an index of the neighbour #7 of any element in terms ofneighbourOffset(int)
method. It is one of possible non-negative values, returned byasPixelTypes
method. You can understand the sense of the name of this constant from the comments to these methods.- See Also:
-
NEIGHBOUR_INDEX_MIN
public static final int NEIGHBOUR_INDEX_MIN0: minimal non-negative value, that can be returned byasPixelTypes
method in this class.- See Also:
-
NEIGHBOUR_INDEX_MAX
public static final int NEIGHBOUR_INDEX_MAX7: maximal non-negative value, that can be returned byasPixelTypes
method in this class.- See Also:
-
-
Method Details
-
getOctupleThinningInstance
Returns the instance of this class, intended for processing skeletons, which are the final result of skeletonization byOctupleThinningSkeleton2D
algorithm.- Returns:
- the classifier of pixels of
OctupleThinningSkeleton2D
skeletons.
-
getQuadruple3x5ThinningInstance
Returns the instance of this class, intended for processing skeletons, which are the final result of skeletonization byQuadruple3x5ThinningSkeleton2D
algorithm.- Returns:
- the classifier of pixels of
Quadruple3x5ThinningSkeleton2D
skeletons.
-
getStrongQuadruple3x5ThinningInstance
Returns the instance of this class, intended for processing skeletons, which are the final result of skeletonization byStrongQuadruple3x5ThinningSkeleton2D
algorithm.- Returns:
- the classifier of pixels of
StrongQuadruple3x5ThinningSkeleton2D
skeletons.
-
pixelTypeOrAttachingBranch
protected int pixelTypeOrAttachingBranch(int apertureBits) Description copied from class:ApertureBasedSkeletonPixelClassifier
Calculates and returns the value of an element C' in the resulting matrix, produced byasPixelTypes
method withNEIGHBOUR_INDEX_OF_ATTACHING_BRANCH
value of attachmentInformation argument, on the base of bit values of all neighbours (in terms of thestraight-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(apertureBits>>>k)&1 ), is equal to the value of the neighbour #k in terms ofneighbourOffset(int)
method. In particular, inBasicSkeletonPixelClassifier2D
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 returnsSkeletonPixelClassifier.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
.- Specified by:
pixelTypeOrAttachingBranch
in classApertureBasedSkeletonPixelClassifier
- Parameters:
apertureBits
- the values of all 8 neighbours of the current unit element of the source skeleton bit matrix.- Returns:
- the type of this pixel of the skeleton.
-
pixelTypeOrAttachedNode
protected int pixelTypeOrAttachedNode(int apertureBits) Description copied from class:ApertureBasedSkeletonPixelClassifier
Calculates and returns the value of an element C' in the resulting matrix, produced byasPixelTypes
method withNEIGHBOUR_INDEX_OF_ATTACHED_NODE
value of attachmentInformation argument, on the base of bit values of all neighbours (in terms of thestraight-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(apertureBits>>>k)&1 ), is equal to the value of the neighbour #k in terms ofneighbourOffset(int)
method. In particular, inBasicSkeletonPixelClassifier2D
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 returnsSkeletonPixelClassifier.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
.- Specified by:
pixelTypeOrAttachedNode
in classApertureBasedSkeletonPixelClassifier
- Parameters:
apertureBits
- the values of all 8 neighbours of the current unit element of the source skeleton bit matrix.- Returns:
- the type of this pixel of the skeleton.
-