Package com.logicaldoc.ocr
Class OCR
- java.lang.Object
-
- com.logicaldoc.ocr.OCR
-
- Direct Known Subclasses:
Advanced,OCRWebService,PowerPDF,Tesseract
public abstract class OCR extends Object
This OCR engine is capable of recognizing characters (letter and numbers) accurately.Environment variables:
OCR_HOME: This env. variable defines the root directory of the external OCR distribution under this directory a subdir for each supported platform must be present(namely windows, linux, macosx and so on). If this variable is not specified, a default engine/ root will be used- Author:
- Alessandro Gasparini
-
-
Constructor Summary
Constructors Constructor Description OCR()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Barcode>extractBarcodes(BufferedImage image, String tenant, Collection<String> possibleFormats)Recognizes all the barcodes inside the given image.List<Barcode>extractBarcodes(File imageFile, String tenant)List<Barcode>extractBarcodes(File imageFile, String tenant, Collection<String> possibleFormats)Recognizes all the barcodes in the given image file.List<Barcode>extractPDFBarcodes(File pdffile, String tenant)List<Barcode>extractPDFBarcodes(File pdffile, String tenant, Collection<String> possibleFormats)Recognizes all the barcodes in the given PDF filevoidextractPDFText(File pdffile, String lang, String tenant, StringBuffer buffer)voidextractText(File imgfile, String lang, String tenant, StringBuffer sb)intgetBarcodeThreshold(String tenant)StringgetParameter(String name)List<String>getParameterNames()Map<String,String>getParameters()intgetResolutionThreshold(String tenant)IntegergetTimeout()booleanisAvailable()static booleanisWindows()voidloadParameters()
-
-
-
Method Detail
-
loadParameters
public void loadParameters()
-
isAvailable
public boolean isAvailable()
-
extractPDFText
public void extractPDFText(File pdffile, String lang, String tenant, StringBuffer buffer) throws IOException
- Throws:
IOException
-
extractText
public void extractText(File imgfile, String lang, String tenant, StringBuffer sb) throws IOException
- Throws:
IOException
-
getResolutionThreshold
public int getResolutionThreshold(String tenant)
-
getBarcodeThreshold
public int getBarcodeThreshold(String tenant)
-
extractBarcodes
public List<Barcode> extractBarcodes(BufferedImage image, String tenant, Collection<String> possibleFormats)
Recognizes all the barcodes inside the given image. The order is up-down, left-right- Parameters:
image- the image to processtenant- name of the tenantpossibleFormats- list of possible barcode formats- Returns:
- the list of extracted barcodes
-
extractBarcodes
public List<Barcode> extractBarcodes(File imageFile, String tenant, Collection<String> possibleFormats)
Recognizes all the barcodes in the given image file.- Parameters:
imageFile- The image file to readtenant- name of the tenantpossibleFormats- Collection of admitted barcode formats- Returns:
- Ordered list of barcodes (up to bottom and left to right)
-
extractPDFBarcodes
public List<Barcode> extractPDFBarcodes(File pdffile, String tenant, Collection<String> possibleFormats)
Recognizes all the barcodes in the given PDF file- Parameters:
pdffile- the pdf file to readtenant- name of the tenantpossibleFormats- collection of admitted barcode formats- Returns:
- ordered list of barcodes (up to bottom and left to right)
-
isWindows
public static boolean isWindows()
-
getTimeout
public Integer getTimeout()
-
-