Class AlgorithmAutoSeedWatershed

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmAutoSeedWatershed
    extends AlgorithmBase
    This is a port of the file AutoSeedWatershed.cpp which calls openCV written by Ravimal Bandara. His web site is titled Image Segmentation using Unsupervised Watershed Algorithm with an Over-segmentation Reduction Technique. This code is written for 2D color images. In response to the question: Would it be possible to modify your code for use on black and white images? What changes would be necessary? Ravimal Bandara responded: Yes you can by creating a gray histogram instead of Hues Saturation histogram. But I am not sure about the accuracy due to the grayscale histograms are less discriminative compared to the colour histogram. His code is licensed under the Code Project Open License (CPOL). The formula for the Bhattacharyya distance for multivariate gaussian distributions is taken from "The Divergence and Bhattacharyya Distance Measures in Signal Selection" by Thomas Kailath, IEEE Transactions on Communication Technology" Vol. COM-15, No. 1, February, 1967, pp. 52-60.
    Author:
    ilb
    • Field Detail

      • segmentNumber

        private int segmentNumber
      • thresholdImage

        private ModelImage thresholdImage
      • distTransformed

        private ModelImage distTransformed
      • scaleX

        private float scaleX
      • scaleY

        private float scaleY
      • mergeSimilar

        private boolean mergeSimilar
      • maxDistance

        private double maxDistance
      • error

        private boolean error
    • Constructor Detail

      • AlgorithmAutoSeedWatershed

        public AlgorithmAutoSeedWatershed​(ModelImage destImg,
                                          ModelImage srcImg,
                                          float scaleX,
                                          float scaleY,
                                          boolean mergeSimilar,
                                          double maxDistance)
        Constructs new watershed algorithm.
        Parameters:
        destImg - Image model where result image is to stored
        srcImg - Source image model
        scaleX -
        scaleY -
        mergeSimilar -
        maxDistance -
    • Method Detail

      • finalize

        public void finalize()
        Prepares this class for destruction.
        Overrides:
        finalize in class AlgorithmBase
      • watershedSegment

        private void watershedSegment()
      • mergeSegments

        private void mergeSegments()