Home

Awesome

TesseractOcr

travis-ci.org hex.pm hex.pm hex.pm hex.pm github.com

Elixir wrapper for Tesseract OCR, an open source text recognition (OCR) Engine.

Requirements

Installation

Add tesseract_ocr to your list of dependencies in mix.exs:

def deps do
  [
    {:tesseract_ocr, "~> 0.1.5"}
  ]
end

Usage

Reading an image file.

iex> TesseractOcr.read("test/resources/world.png")
"world"

With additional options.

iex> TesseractOcr.read("test/resources/world.png", %{lang: "por", psm: 7, oem: 1})
"world"

Get words positions.

iex> TesseractOcr.Words.read("test/resources/world.png")
[%{confidence: 95, word: "world", x_end: 185, x_start: 2, y_end: 56, y_start: 2}]

Convert image into PDF with text.

iex> TesseractOcr.PDF.read("test/resources/world.png", "/tmp/test")
"/tmp/test.pdf"

Convert image into TSV with text.

iex> TesseractOcr.TSV.read("test/resources/world.png", "/tmp/test")
"/tmp/test.tsv"