net.sourceforge.javaocr.plugin.fir
Class MedianFilter

java.lang.Object
  extended by net.sourceforge.javaocr.plugin.fir.AbstractNeighborhoodFilter
      extended by net.sourceforge.javaocr.plugin.fir.MedianFilter
All Implemented Interfaces:
ImageFilter

public class MedianFilter
extends AbstractNeighborhoodFilter

Apply median filter to image, useful to clean up after thresholding. TODO Works for binarized images only, could be extended to grayscale.

Author:
Andrea De Pasquale

Field Summary
private  int counter
           
private  int[] pixels
           
 
Fields inherited from class net.sourceforge.javaocr.plugin.fir.AbstractNeighborhoodFilter
filterH, filterW
 
Constructor Summary
MedianFilter(int width, int height, Image dest)
          Create a MedianFilter, which selects median value from pixels inside a given neighborhood.
 
Method Summary
protected  int processNeighborhood(Image nImage)
          compute pixel value by looking up values in the neighborhood image
 
Methods inherited from class net.sourceforge.javaocr.plugin.fir.AbstractNeighborhoodFilter
process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pixels

private int[] pixels

counter

private int counter
Constructor Detail

MedianFilter

public MedianFilter(int width,
                    int height,
                    Image dest)
Create a MedianFilter, which selects median value from pixels inside a given neighborhood.

Parameters:
width - Neighborhood width; if even, filter expands to the right only.
height - Neighborhood height; if even, filter expands to the bottom only.
dest - The image to be filled up during processing.
Method Detail

processNeighborhood

protected int processNeighborhood(Image nImage)
Description copied from class: AbstractNeighborhoodFilter
compute pixel value by looking up values in the neighborhood image

Specified by:
processNeighborhood in class AbstractNeighborhoodFilter


Copyright © -2012. All Rights Reserved.