OCR

OCR web services gateway for Ruby.

Description

Recognize text and characters from image files using web services.

Web services supported

  • OCR Web Service(Online OCR)
    • identify: Username and license code as password
    • languages: :brazilian, :byelorussian, :bulgarian, :catalan, :croatian, :czech, :danish, :dutch, :english, :estonian, :finnish, :french, :german, :greek, :hungarian, :indonesian, :italian, :latin, :latvian, :lithuanian, :moldavian, :polish, :portuguese, :romanian, :russian, :serbian, :slovakian, :slovenian, :spanish, :swedish, :turkish, :ukrainian
    • output formats: :doc, :pdf, :excel, :html, :txt, :rtf
  • Free OCR online webservice
    • identify: Username

Installation

From the command line

  gem install ocr

Using Gemfile

1 Add to your application Gemfile

gem 'ocr'

2 Type

  bundle install

Using

  • Get a OCR: ocr = OCR.use
  • Set the login Credentials: ocr.login , , []
  • Set proxy configuration: ocr.proxy p_addr, p_port = nil, p_user = nil, p_pass = nil
  • Set image to work: ocr.file=
  • Set languaje: ocr.file=
  • Set output format: ocr.format=
  • Set output file: ocr.outputfile=
  • Test error: error = ocr.error if ocr.error?
  • Results: text = ocr.text unless ocr.error?

OCR Web Service

More info at OCR Web Service.

Extra properties convert_to_bw=, multi_page_doc=.

  ocr = OCR.use :onlineocr

  ocr. <YOUR_USER>, <YOUR_LICENSE_CODE>
  ocr.file= 'text_image.jpg'
  ocr.format= :pdf
  ocr.outputfile= 'text_doc.pdf'
  ocr.recognize

  puts "ERROR: #{ocr.error}" if ocr.error?
  puts "RESULT: #{ocr.text}" unless ocr.error?

Free OCR online webservice

More info at Free OCR online webservice.

  ocr = OCR.use :free_ocr

  ocr. <YOUR_USER_NAME>
  ocr.file= 'text_image.jpg'
  ocr.recognize

  puts "ERROR: #{ocr.error}" if ocr.error?
  puts "RESULT: #{ocr.text}" unless ocr.error?

License

Released under the MIT license: http://www.opensource.org/licenses/MIT