Package boofcv.alg.segmentation
Class ImageSegmentationOps
java.lang.Object
boofcv.alg.segmentation.ImageSegmentationOps
Useful functions related to image segmentation
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
countRegionPixels
(GrayS32 labeled, int which) Counts the number of instances of 'which' inside the labeled image.static void
countRegionPixels
(GrayS32 labeled, int totalRegions, int[] counts) Counts the number of pixels in all regions.static void
markRegionBorders
(GrayS32 labeled, GrayU8 output) Indicates border pixels between two regions.static void
regionPixelId_to_Compact
(GrayS32 graph, DogArray_I32 segmentId, GrayS32 output) Compacts the region labels such that they are consecutive numbers starting from 0.
-
Constructor Details
-
ImageSegmentationOps
public ImageSegmentationOps()
-
-
Method Details
-
countRegionPixels
Counts the number of instances of 'which' inside the labeled image.- Parameters:
labeled
- Image which has been labeledwhich
- The label being searched for- Returns:
- Number of instances of 'which' in 'labeled'
-
countRegionPixels
Counts the number of pixels in all regions. Regions must be have labels from 0 to totalRegions-1.- Parameters:
labeled
- (Input) labeled imagetotalRegions
- Total number of regionscounts
- Storage for pixel counts
-
regionPixelId_to_Compact
Compacts the region labels such that they are consecutive numbers starting from 0. The ID of a root node must the index of a pixel in the 'graph' image, taking in account the change in coordinates for sub-images.- Parameters:
graph
- Input segmented image where the ID's are not compactedsegmentId
- List of segment ID's. See comment above about what ID's are acceptable.output
- The new image after it has been compacted
-
markRegionBorders
Indicates border pixels between two regions. If two adjacent pixels (4-connect) are not from the same region then both pixels are marked as true (value of 1) in output image, all other pixels are false (0).- Parameters:
labeled
- Input segmented image.output
- Output binary image. 1 for border pixels.
-