Class MedianFilter

  • All Implemented Interfaces:
    Filter

    public class MedianFilter
    extends java.lang.Object
    implements Filter
    Given a buffered image / path to image file, it'll compute median of pixel intensity values in neighbourhood around it ( size of neighbourhood depends upon order [ >0 ] supplied while invoking filter ) for each pixel position. Processing multiple pixels can be done at a time because concurrency support has already been incorporated.

    This model uses a row based concurrency model i.e. each row of image matrix to be processed on thread pool

    • Constructor Summary

      Constructors 
      Constructor Description
      MedianFilter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.image.BufferedImage filter​(java.awt.image.BufferedImage img, int order)
      Concurrently applies median filter on each row of image matrix ( prior to this implementation, was using pixel based concurrency, which was slowing down whole op for very large images )
      java.awt.image.BufferedImage filter​(java.lang.String src, int order)
      Applies median filter on given buffered image, returning a new buffered image
      java.lang.String filterName()
      Returns name of this filter
      boolean isOrderValid​(int order)
      Checks whether requested order of filter can be applied or not, order needs to be > 0
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MedianFilter

        public MedianFilter()
    • Method Detail

      • isOrderValid

        public boolean isOrderValid​(int order)
        Checks whether requested order of filter can be applied or not, order needs to be > 0
        Specified by:
        isOrderValid in interface Filter
        Parameters:
        order - Order of filter to be applied
        Returns:
        Whether order value is valid or not
      • filter

        public java.awt.image.BufferedImage filter​(java.awt.image.BufferedImage img,
                                                   int order)
        Concurrently applies median filter on each row of image matrix ( prior to this implementation, was using pixel based concurrency, which was slowing down whole op for very large images )
        Specified by:
        filter in interface Filter
        Parameters:
        img - buffered image instance, on which filter to be applied
        order - > = 1, order of filter to be applied, decides size of mask for convolution
        Returns:
        modified buffered image, not the supplied one
      • filter

        public java.awt.image.BufferedImage filter​(java.lang.String src,
                                                   int order)
        Applies median filter on given buffered image, returning a new buffered image
        Specified by:
        filter in interface Filter
        Parameters:
        src - Image to be filtered
        order - Order of filtering to be applied
        Returns:
        Filtered buffered image
      • filterName

        public java.lang.String filterName()
        Returns name of this filter
        Specified by:
        filterName in interface Filter
        Returns:
        name of filter