Giter Site home page Giter Site logo

gocr's Introduction

gocr

gocr is a go based OCR module

Available Scanner

  • Linear Mean Scanner
  • Circular Scanner (Currently the best)

Available predictor

  • NNPredictor (kNN with k = 1)
  • CNNPredictor (Need to install tensorflow first) (Doesn't upport custom train)

Future Improvement

  • Sauvola Segmentation
  • Better character detection
  • Better symbol detection
  • Spelling Correction

How to use

To use OCR we have some generated Model that we train using tensorflow. We use Convolutional Neural Network as the model architecture and produce good detection.

You can load and use the model to CNN Predictor like this example below:

d, _ := os.Getwd()

image, _ := gocr.ReadImage(d + "/imagetext_3.png")
s := gocr.NewCNNPredictorFromDir(modelPath + "tensor_4/")

// Define the image size
s.InputHeight, s.InputWidth = 64, 64

strings := gocr.ScanToStrings(s, image)
for _, s := range strings {
  fmt.Println(s)
}

However you can also use your own train data. Currently the predictor that support custom training only NNPredictor. Training takes csv file that have file image path and string representation.

ie:

a.gif,a
b.gif,b
A1.gif,A
B1.gif,B

Train the sample data to model and scan image

d, _ := os.Getwd()

// Load the sample data and save it in model.cbor file
err := gocr.TrainAverage(d+"/English/Fnt/", d+"/English/")
if err != nil {
  panic(err)
}

image, _ := gocr.ReadImage(d + "/imagetext_3.png")
s := gocr.NewCNNPredictorFromDir(modelPath + "sample1/model.cbor")

strings := gocr.ScanToStrings(s, image)
for _, s := range strings {
  fmt.Println(s)
}

License

gocr is released under the Apache 2.0 License. se LICENSE for details.

gocr's People

Contributors

sugab avatar agungkeys avatar ariefdarmawan avatar

Stargazers

Alexander Paliy       avatar Hícaro José Barbosa Soares avatar @lpha avatar  avatar Alexandre avatar LUÍS CARLOS DE SOUZA  MENEZES avatar Diego De Santiago avatar  avatar POLINOME avatar Ludger Meyer-Wülfing avatar Abanoub Hanna avatar Sara Lara avatar Jonathan Zhang avatar Tsang Chi Wan avatar Ruhm avatar  avatar Chris MacKay avatar Bhanu Harsha Pasam avatar Josué Rodriguez avatar HeisenBerg? avatar Jan Olszak avatar dags avatar Luqman A. Siswanto avatar surya dantuluri avatar Manuel Durán Aguete avatar  avatar Mustafa Yasin Halici avatar

Watchers

James Cloos avatar Zhanliang Liu avatar  avatar  avatar  avatar Eko B. Karuniawan avatar  avatar  avatar

gocr's Issues

invalid method expression archiver

root@debian:~/ocr# go run main.go

github.com/eaciit/gocr

/root/go/pkg/mod/github.com/eaciit/[email protected]/train.go:76:22: invalid method expression archiver.TarGz.Open (needs pointer receiver: (*archiver.TarGz).Open)

I am trying to use your repo but getting the above error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.