Class ImageSegmentationOps

java.lang.Object
boofcv.alg.segmentation.ImageSegmentationOps

public class ImageSegmentationOps
extends Object
Useful functions related to image segmentation
  • Constructor Details

    • ImageSegmentationOps

      public ImageSegmentationOps()
  • Method Details

    • countRegionPixels

      public static int countRegionPixels​(GrayS32 labeled, int which)
      Counts the number of instances of 'which' inside the labeled image.
      Parameters:
      labeled - Image which has been labeled
      which - The label being searched for
      Returns:
      Number of instances of 'which' in 'labeled'
    • countRegionPixels

      public 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.
      Parameters:
      labeled - (Input) labeled image
      totalRegions - Total number of regions
      counts - Storage for pixel counts
    • regionPixelId_to_Compact

      public 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. 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 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
    • markRegionBorders

      public static void markRegionBorders​(GrayS32 labeled, GrayU8 output)
      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.