Skip to content
This repository

Ruby library for working with the Tesseract OCR.

gemspec

latest commit 153276312d
Danilo Jeremias da Silva authored February 25, 2014
Octocat-spinner-32 lib Updates February 25, 2014
Octocat-spinner-32 spec comment February 25, 2014
Octocat-spinner-32 .document Version 1.0.0 November 21, 2013
Octocat-spinner-32 .gitignore Gitignore November 21, 2013
Octocat-spinner-32 .rspec Version 1.0.0 November 21, 2013
Octocat-spinner-32 .travis.sh Install tesseract OCR for travis February 05, 2014
Octocat-spinner-32 .travis.yml Install tesseract OCR for travis February 05, 2014
Octocat-spinner-32 Gemfile Add quick_magick gem February 07, 2014
Octocat-spinner-32 Gemfile.lock Add quick_magick gem February 07, 2014
Octocat-spinner-32 LICENSE.txt Update jeweler February 07, 2014
Octocat-spinner-32 README.rdoc Gittip February 22, 2014
Octocat-spinner-32 Rakefile Update jeweler February 07, 2014
Octocat-spinner-32 VERSION Version bump to 1.2.1 February 25, 2014
Octocat-spinner-32 rtesseract.gemspec gemspec February 25, 2014
README.rdoc

rtesseract

Gem Version Build Status Coverage Status

Ruby library for working with the Tesseract OCR.

REQUIREMENTS:

To work properly rtesseract are needed:

  • Tesseract - Program

  • ImageMagic - Program

  • RMagick or mini_magick or quick_magick - Gem

Atention: Version 1.0.0 works fine with Ruby 2.0 and tesseract 3.0 and lower versions of rtesseract works fine with Ruby 1.8 and tesseract 2.0.4.

EXAMPLE USAGE

It's very simple to use rtesseract:

CONVERT IMAGE TO STRING

image = RTesseract.new("my_image.jpg")
image.to_s #Getting the value

CHANGE THE IMAGE

image = RTesseract.new("my_image.jpg")
image.source = "new_image.png"
image.to_s

TRANSFORM THE IMAGE

image = RTesseract.read("my_image.jpg") do |img|
  img = img.white_threshold(245)
  img = img.quantize(256,Magick::GRAYColorspace)
end
image.to_s

CONVERT PARTS OF IMAGE TO STRING

mix_block = RTesseract::Mixed.new("test.jpg") do |image|
  image.area(28,  19, 25, 25)
  image.area(180, 22, 20, 28)
  image.area(218, 22, 24, 28)
  image.area(248, 24, 22, 22)
end
mix_block.to_s

OR

mix_block = RTesseract::Mixed.new("test.jpg",{:areas => [
  {:x => 28,  :y=>19, :width=>25, :height=>25 },
  {:x => 180,  :y=>22, :width=>20, :height=>28},
  {:x => 218,  :y=>22, :width=>24, :height=>28},
  {:x => 248,  :y=>24, :width=>22, :height=>22}
]})
mix_block.to_s

OPTIONS

Processors Options (Rmagick is default)

RTesseract.new("test.jpg", :processor => "mini_magick")

Language Options

RTesseract.new("test.jpg", :lang => "deu")
   * eng   - English
   * deu   - German
   * deu-f - German fraktur
   * fra   - French
   * ita   - Italian
   * nld   - Dutch
   * por   - Portuguese
   * spa   - Spanish
   * vie   - Vietnamese
Note: Make sure you have installed the language to tesseract

Contributing to rtesseract

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Links

Copyright

Copyright © 2014 Danilo Jeremias da Silva. See LICENSE.txt for further details.

Something went wrong with that request. Please try again.