Skip to content

Latest commit

 

History

History
executable file
·
68 lines (47 loc) · 1.49 KB

File metadata and controls

executable file
·
68 lines (47 loc) · 1.49 KB

Ruby library for working with the Tesseract OCR.

To work properly rtesseract are needed:

  • Tesseract - Program

  • ImageMagic - Program

  • RMagick - Gem

It’s very simple to use rtesseract:

image = RTesseract.new("my_image.jpg")
image.to_s #Getting the value
image = RTesseract.new("my_image.jpg")
image.source = "new_image.png"
image.to_s
image = RTesseract.read("my_image.jpg") do |img|
  img = img.white_threshold(245)
  img = img.quantize(256,Magick::GRAYColorspace)
end
image.to_s
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
  • Fork the project.

  • Make your feature addition or bug fix.

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2012 Danilo Jeremias da Silva. See LICENSE for details.