net.sourceforge.javaocr.filter
Class HistogramFilter

java.lang.Object
  extended by net.sourceforge.javaocr.filter.AbstractSinglePixelFilter
      extended by net.sourceforge.javaocr.filter.HistogramFilter
All Implemented Interfaces:
ImageFilter

public class HistogramFilter
extends AbstractSinglePixelFilter

collect image histogram and perform useful calculations on it

Author:
Konstantin Pribluda

Field Summary
(package private)  int amount_bins
           
private static int DEFAULT_BINS
           
(package private)  int[] defaultSmooth
           
(package private)  int[] histogramm
           
(package private)  int totalCount
           
 
Constructor Summary
HistogramFilter()
           
HistogramFilter(int amount_bins)
           
 
Method Summary
 int adaptiveThreshold()
          compute adaptive threshold in iterative way starting from the middle of histogramm.
 int adaptiveThreshold(int threshold)
          recursively compute adaptive threshold
private  int computeM(int from, int to)
          compute meadian out of defined span
 void fold(int[] folder)
          Deprecated. does it makes sense at all?
 int[] getHistogramm()
           
 int getTotalCount()
           
protected  void processPixel(Image image)
          process single image pixel subclass shall retrieve current pixel value with image.next() and store it with image.put() after processing
 void reset()
           
 void smooth()
          Deprecated. does it makes sense at all?
 
Methods inherited from class net.sourceforge.javaocr.filter.AbstractSinglePixelFilter
process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultSmooth

int[] defaultSmooth

histogramm

int[] histogramm

totalCount

int totalCount

DEFAULT_BINS

private static final int DEFAULT_BINS
See Also:
Constant Field Values

amount_bins

final int amount_bins
Constructor Detail

HistogramFilter

public HistogramFilter()

HistogramFilter

public HistogramFilter(int amount_bins)
Method Detail

getHistogramm

public int[] getHistogramm()

getTotalCount

public int getTotalCount()

reset

public void reset()

processPixel

protected void processPixel(Image image)
Description copied from class: AbstractSinglePixelFilter
process single image pixel subclass shall retrieve current pixel value with image.next() and store it with image.put() after processing

Specified by:
processPixel in class AbstractSinglePixelFilter

smooth

public void smooth()
Deprecated. does it makes sense at all?

perform historgramm smoothing woth default coeefficitns { 1,2,1}


fold

public void fold(int[] folder)
          throws IllegalArgumentException
Deprecated. does it makes sense at all?

perform folding (smoothing, sharpening... depending on coeff array). TODO: what do we do with border conditions? zero them? let in peace? assume folding coefficients outside border to be 0?

Parameters:
folder - array contaning folding coefficients. must have odd length
Throws:
IllegalArgumentException

adaptiveThreshold

public int adaptiveThreshold()
compute adaptive threshold in iterative way starting from the middle of histogramm. for the best results image shall be normalised or enhanced befode doing this

Returns:

adaptiveThreshold

public int adaptiveThreshold(int threshold)
recursively compute adaptive threshold

Parameters:
threshold - start value for threshold computation
Returns:

computeM

private int computeM(int from,
                     int to)
compute meadian out of defined span

Parameters:
from - value (inclusive)
to - too value (exclusive)
Returns:


Copyright © -2012. All Rights Reserved.