Class 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 Detail

      • OCR

        public OCR()
    • Method Detail

      • loadParameters

        public void loadParameters()
      • getParameter

        public String getParameter​(String name)
      • getParameterNames

        public List<String> getParameterNames()
      • isAvailable

        public boolean isAvailable()
      • 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 process
        tenant - name of the tenant
        possibleFormats - 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 read
        tenant - name of the tenant
        possibleFormats - 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 read
        tenant - name of the tenant
        possibleFormats - 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()