public class ImageSegmentationOps extends Object
Useful functions related to image segmentation
Method SummaryModifier and TypeMethodDescription
static intCounts the number of instances of 'which' inside the labeled image.
static voidCounts the number of pixels in all regions.
static voidIndicates border pixels between two regions.
static voidCompacts the region labels such that they are consecutive numbers starting from 0.
countRegionPixelspublic static int countRegionPixels
(GrayS32 labeled, int which)Counts the number of instances of 'which' inside the labeled image.
labeled- Image which has been labeled
which- The label being searched for
- Number of instances of 'which' in 'labeled'
countRegionPixelspublic static void countRegionPixels
(GrayS32 labeled, int totalRegions, int counts)Counts the number of pixels in all regions. Regions must be have labels from 0 to totalRegions-1.
labeled- (Input) labeled image
totalRegions- Total number of regions
counts- Storage for pixel counts
regionPixelId_to_CompactCompacts 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.
graph- Input segmented image where the ID's are not compacted
segmentId- List of segment ID's. See comment above about what ID's are acceptable.
output- The new image after it has been compacted
markRegionBordersIndicates 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).
labeled- Input segmented image.
output- Output binary image. 1 for border pixels.