GithubHelp home page GithubHelp logo

ocarina's Introduction

Ocarina - Optical Character Recognition (OCR) for Ruby

A Ruby project that uses machine learning to perform Optical Character Recognition.

I created this project to learn Ruby beyond what you need for Rails, and also just to see if I could actually create an OCR lib. It started as kind of a toy program, but quickly grew into something with a practical purpose (decoding Letterpress gameboards!)

It works fairly well on constrained input, but it's not really intended to be a production-level OCR package.

Status

Ocarina successfully trains and recognizes the 26 letters of the alphabet. Once trained, the network accurately recognizes its training set and also recognizes characters with added noise.

I'm still working on how best to organize the neural network (# of hidden nodes, # of outputs, edge weights) to increase the set size to support the full ASCII (and beyond) alphabet.

Motivation

I first encountered OCR technology back in 1991 or so, on an Apple Macintosh. It seemed like magic, even though it was a pretty poor implementation by today's standards. Recently I came across the Sudoku Grab app. It does OCR very successfully, albeit on very constrained input images.

This inspired me to try to create my own (simplistic) OCR implementation, and that seemed like a great way to learn Ruby.

Installation

Dependencies

Ocarina depends on ImageMagick (and the RMagick gem) to do its graphics processing. On OSX at least, ImageMagick requires X11 and ghostscript. You'll likely need to do the following:

  1. Download and install X11Quartz
  2. brew install imagemagick
  3. brew install ghostscript

For Linux (I'm on Centos 5.8) I had to build ImageMagick 6.8 from source, install it, install the source into /usr/local/src/ImageMagick-6.8.0-4/magick and then run:

  1. export PKG_CONFIG_PATH=/usr/local/src/ImageMagick-6.8.0-4/magick/
  2. add /usr/local/lib to the system LD_LIBRARY_PATH
  3. gem install rmagick

Usage

To train on bitmaps created with ImageMagick:

  • rake ocarina:train
  • rake ocarina:eval

You can also train a network to recognize Letterpress tiles:

  • rake ocarina:letterpress

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

LICENSE

Copyright 2012 George Armhold

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

ocarina's People

Contributors

armhold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.