java.lang.Object
imagingbook.common.regions.BinaryRegionSegmentation
imagingbook.common.regions.RegionContourSegmentation
- All Implemented Interfaces:
ContourTracer
Binary region segmentation based on a combined region labeling and contour tracing algorithm as described in [1]. Detected regions and contours are 4- or 8-connected. See Sec. 8.2.2 of [2] for additional details.
[1] F. Chang, C. J. Chen, and C. J. Lu. A linear-time component labeling algorithm using contour tracing technique.
Computer Vision, Graphics, and Image Processing: Image Understanding 93(2), 206-220 (2004).
[2] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer
(2022).
- Version:
- 2022/09/28
-
Field Summary
Fields inherited from class imagingbook.common.regions.BinaryRegionSegmentation
DefaultNeighborhoodT -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves all inner contours of the associated region labeling.getInnerContours(boolean sort) Retrieves all inner contours of the associated region labeling.intgetLabel(int u, int v) Returns the label number for the specified image coordinate. -1 is returned for out-of-image coordinates.Retrieves all outer contours of the associated region labeling.getOuterContours(boolean sort) Retrieves all outer contours of the associated region labeling.Methods inherited from class imagingbook.common.regions.BinaryRegionSegmentation
getHeight, getMaxLabel, getMinLabel, getRegion, getRegion, getRegions, getRegions, getWidth, isSegmented
-
Constructor Details
-
RegionContourSegmentation
Constructor. Creates a combined region and contour segmentation from the specified image, which is not modified. The input image is considered binary, with 0 values for background pixels and values ≠ 0 for foreground pixels. The 4-neighborhood is used by default (BinaryRegionSegmentation.DefaultNeighborhoodT).- Parameters:
ip- the binary input image to be segmented
-
RegionContourSegmentation
Constructor. Creates a combined region and contour segmentation from the specified image and neighborhood type (4- or 8-neighborhood). The input image is considered binary, with 0 values for background pixels and values ≠ 0 for foreground pixels.- Parameters:
ip- the binary input image to be segmentednh- the neighborhood type (4- or 8-neighborhood)
-
-
Method Details
-
getOuterContours
Description copied from interface:ContourTracerRetrieves all outer contours of the associated region labeling.- Specified by:
getOuterContoursin interfaceContourTracer- Returns:
- the list of outer contours.
-
getOuterContours
Description copied from interface:ContourTracerRetrieves all outer contours of the associated region labeling.- Specified by:
getOuterContoursin interfaceContourTracer- Parameters:
sort- set true to sort contours by (descending) length.- Returns:
- the list of outer contours.
-
getInnerContours
Description copied from interface:ContourTracerRetrieves all inner contours of the associated region labeling.- Specified by:
getInnerContoursin interfaceContourTracer- Returns:
- the list of inner contours.
-
getInnerContours
Description copied from interface:ContourTracerRetrieves all inner contours of the associated region labeling.- Specified by:
getInnerContoursin interfaceContourTracer- Parameters:
sort- set true to sort contours by (descending) length.- Returns:
- the list of inner contours.
-
getLabel
Description copied from class:BinaryRegionSegmentationReturns the label number for the specified image coordinate. -1 is returned for out-of-image coordinates.- Overrides:
getLabelin classBinaryRegionSegmentation- Parameters:
u- the horizontal coordinate.v- the vertical coordinate.- Returns:
- the label number for the given position or -1 if outside the image
-