java.lang.Object
imagingbook.common.regions.BinaryRegionSegmentation
- Direct Known Subclasses:
BreadthFirstSegmentation,DepthFirstSegmentation,RecursiveSegmentation,RegionContourSegmentation,SequentialSegmentation
Performs region segmentation on a given binary image. See Ch. 8 of [1] for additional details. This class is
abstract, since the implementation depends on the concrete region segmentation algorithm being used. Concrete
implementations (subclasses of this class) are BreadthFirstSegmentation, DepthFirstSegmentation,
RecursiveSegmentation, SequentialSegmentation, RegionContourSegmentation. Most of the work is
done by the constructor(s). If the segmentation has failed for some reason getRegions() returns
null.
[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
- Version:
- 2021/12/22
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintReturns the height of the segmented image.intgetLabel(int u, int v) Returns the label number for the specified image coordinate. -1 is returned for out-of-image coordinates.intReturns the maximum label assigned by this segmentation.intReturns the minimum label assigned by this segmentation.getRegion(int label) Finds the region associated to the specified label ornullif no region for that label exists.getRegion(int u, int v) Returns theBinaryRegioninstance associated with the given image position ornullif the segmentation contains no region covering the given position.Returns an unsorted list of all regions associated with this region labeling.getRegions(boolean sort) Returns a (optionally sorted) list of all regions associated with this region labeling.intgetWidth()Returns the width of the segmented image.booleanReturns true if the segmentation did complete successfully, false otherwise.
-
Field Details
-
DefaultNeighborhoodT
The default neighborhood type.
-
-
Method Details
-
getWidth
Returns the width of the segmented image.- Returns:
- the width of the segmented image
-
getHeight
Returns the height of the segmented image.- Returns:
- the height of the segmented image
-
getMinLabel
Returns the minimum label assigned by this segmentation.- Returns:
- the minimum label
-
getMaxLabel
Returns the maximum label assigned by this segmentation.- Returns:
- the maximum label
-
isSegmented
Returns true if the segmentation did complete successfully, false otherwise.- Returns:
- true if segmentation was successful
-
getRegions
Returns an unsorted list of all regions associated with this region labeling. The returned list is empty if no regions were detected. See alsogetRegions(boolean).- Returns:
- a (possibly empty) list of detected regions
-
getRegions
Returns a (optionally sorted) list of all regions associated with this region labeling. The returned list is empty if no regions were detected.- Parameters:
sort- settrueto sort regions by size (largest regions first).- Returns:
- the list of detected regions or
nullif the segmentation has failed.
-
getLabel
Returns the label number for the specified image coordinate. -1 is returned for out-of-image coordinates.- Parameters:
u- the horizontal coordinate.v- the vertical coordinate.- Returns:
- the label number for the given position or -1 if outside the image
-
getRegion
Finds the region associated to the specified label ornullif no region for that label exists.- Parameters:
label- the region's label number- Returns:
- the region object associated with the given label or
nullif it does not exist
-
getRegion
Returns theBinaryRegioninstance associated with the given image position ornullif the segmentation contains no region covering the given position.- Parameters:
u- the horizontal position.v- the vertical position.- Returns:
- The associated
BinaryRegionobject ornullif thisBinaryRegionSegmentationhas no region at the given position.
-