gosseract

package module
v0.0.0-...-df11bbf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2017 License: MIT Imports: 9 Imported by: 0

README

Gosseract-OCR Build Status GoDoc

Tesseract-OCR command wrapper for Golang

code example

package main

import (
	"fmt"
	"github.com/otiai10/gosseract"
)

func main() {
    // This is the simplest way :)
    out := gosseract.Must(gosseract.Params{
			Src:       "your/img/file.png",
			Languages: "eng+heb",
    })
    fmt.Println(out)

    // Using client
    client, _ := gosseract.NewClient()
    out, _ = client.Src("your/img/file.png").Out()
    fmt.Println(out)
}

sample application

ocrserver ocrserver: the minimum OCR server with using gosseract.

installation

  1. install tesseract-ocr
  2. install go
  3. install gosseract
    • go get github.com/otiai10/gosseract
  4. install mint for testing
    • go get github.com/otiai10/mint
  5. run the tests at first↓

test

go test ./...

dependencies

issues

Documentation

Index

Constants

View Source
const TESSERACT = "tesseract"

Variables

This section is empty.

Functions

func Must

func Must(params Params) (out string)

Must execute tesseract-OCR directly by parameter map

Types

type Client

type Client struct {
	Error error
	// contains filtered or unexported fields
}

Client is an client to use gosseract functions

func NewClient

func NewClient() (c *Client, e error)

NewClient provide reference to new Client

func (*Client) Digest

func (c *Client) Digest(digestPath string) *Client

Digest accepts path to target digest file

func (*Client) Image

func (c *Client) Image(img image.Image) *Client

Image accepts image object of target

func (*Client) Must

func (c *Client) Must(params map[string]string) (out string, e error)

Must executes tesseract directly by parameter map

func (*Client) Out

func (c *Client) Out() (out string, e error)

Out executes tesseract and gives results

func (*Client) Src

func (c *Client) Src(srcPath string) *Client

Src accepts path to target source file

type Params

type Params struct {
	Src       string // source image file path
	Whitelist string // tessedit_char_whitelist
	Languages string
}

Params is parameters for gosseract.Must.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL