net.sourceforge.javaocr.ocr
Class AbstractBaseSlicer

java.lang.Object
  extended by net.sourceforge.javaocr.ocr.AbstractBaseSlicer
All Implemented Interfaces:
ImageSlicer
Direct Known Subclasses:
SlicerH, SlicerV

public abstract class AbstractBaseSlicer
extends Object
implements ImageSlicer

abstract base slicer class encapsulating common functionality


Field Summary
protected  int border
           
protected  int currentPosition
           
(package private)  int empty
           
(package private)  Image image
           
(package private)  int tolerance
           
 
Constructor Summary
AbstractBaseSlicer(int empty, Image image, int border)
           
 
Method Summary
protected abstract  Image chisel(int imageStart)
           
 boolean hasNext()
          whether we have next image chunk available
protected abstract  void iterateSpan()
           
 Image next()
          chisel out sub-image with pre configured tolerance
 ImageSlicer slice(int fromY)
          start slicing from designated position with zero tolerance
 ImageSlicer slice(int from, int tolerance)
          start horizontal slicing from designated position tolerating some empty rows
protected  boolean spanEmpty()
          whether current image span is empty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

image

Image image

empty

int empty

currentPosition

protected int currentPosition

tolerance

int tolerance

border

protected int border
Constructor Detail

AbstractBaseSlicer

public AbstractBaseSlicer(int empty,
                          Image image,
                          int border)
Method Detail

slice

public ImageSlicer slice(int fromY)
start slicing from designated position with zero tolerance

Specified by:
slice in interface ImageSlicer
Parameters:
fromY - starting Y

hasNext

public boolean hasNext()
whether we have next image chunk available

Specified by:
hasNext in interface ImageSlicer
Returns:

slice

public ImageSlicer slice(int from,
                         int tolerance)
start horizontal slicing from designated position tolerating some empty rows

Specified by:
slice in interface ImageSlicer
Parameters:
from - starting position
tolerance - amount of empty rows allowed inside consecutive image

spanEmpty

protected boolean spanEmpty()
whether current image span is empty

Returns:

next

public Image next()
chisel out sub-image with pre configured tolerance

Specified by:
next in interface ImageSlicer
Returns:
subimage

chisel

protected abstract Image chisel(int imageStart)

iterateSpan

protected abstract void iterateSpan()


Copyright © -2012. All Rights Reserved.