net.sourceforge.javaocr.ocrPlugins.aspectRatio
Class AspectRatioOCR

java.lang.Object
  extended by net.sourceforge.javaocr.scanner.DocumentScannerListenerAdaptor
      extended by net.sourceforge.javaocr.ocrPlugins.aspectRatio.AspectRatioOCR
All Implemented Interfaces:
AccuracyProviderInterface, DocumentScannerListener

public class AspectRatioOCR
extends DocumentScannerListenerAdaptor
implements AccuracyProviderInterface

Provides an OCR that can be used in addition to other OCR plug-ins to increase accuracy.

Author:
William Whitney

Field Summary
private  ArrayList<CharacterRatio> charRatioList
           
private  DocumentScanner documentScanner
           
private  AccuracyListenerInterface listener
           
private static Logger LOG
           
private  HashMap<Character,ArrayList<TrainingImage>> trainingImages
           
 
Constructor Summary
AspectRatioOCR(HashMap<Character,ArrayList<TrainingImage>> trainingImages)
           
 
Method Summary
 void acceptAccuracyListener(AccuracyListenerInterface listener)
           
private  OCRIdentification determineCharacterPossibilities(double targetRatio)
           
 void endRow(PixelImage pixelImage, int y1, int y2)
           
private  double getRatio(int width, int height)
           
 void processChar(PixelImage pixelImage, int x1, int y1, int x2, int y2, int rowY1, int rowY2)
           
 void processSpace(PixelImage pixelImage, int x1, int y1, int x2, int y2)
           
private  void processTrainingImages()
           
 void scan(BufferedImage targetBfImage)
           
 
Methods inherited from class net.sourceforge.javaocr.scanner.DocumentScannerListenerAdaptor
beginDocument, beginRow, endDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listener

private AccuracyListenerInterface listener

trainingImages

private final HashMap<Character,ArrayList<TrainingImage>> trainingImages

charRatioList

private final ArrayList<CharacterRatio> charRatioList

documentScanner

private DocumentScanner documentScanner

LOG

private static final Logger LOG
Constructor Detail

AspectRatioOCR

public AspectRatioOCR(HashMap<Character,ArrayList<TrainingImage>> trainingImages)
Method Detail

scan

public void scan(BufferedImage targetBfImage)

acceptAccuracyListener

public void acceptAccuracyListener(AccuracyListenerInterface listener)
Specified by:
acceptAccuracyListener in interface AccuracyProviderInterface

endRow

public void endRow(PixelImage pixelImage,
                   int y1,
                   int y2)
Specified by:
endRow in interface DocumentScannerListener
Overrides:
endRow in class DocumentScannerListenerAdaptor

processChar

public void processChar(PixelImage pixelImage,
                        int x1,
                        int y1,
                        int x2,
                        int y2,
                        int rowY1,
                        int rowY2)
Specified by:
processChar in interface DocumentScannerListener
Overrides:
processChar in class DocumentScannerListenerAdaptor

processSpace

public void processSpace(PixelImage pixelImage,
                         int x1,
                         int y1,
                         int x2,
                         int y2)
Specified by:
processSpace in interface DocumentScannerListener
Overrides:
processSpace in class DocumentScannerListenerAdaptor

processTrainingImages

private void processTrainingImages()

getRatio

private double getRatio(int width,
                        int height)

determineCharacterPossibilities

private OCRIdentification determineCharacterPossibilities(double targetRatio)


Copyright © -2012. All Rights Reserved.