Class: Despeck::Ocr
- Inherits:
-
Object
- Object
- Despeck::Ocr
- Defined in:
- lib/despeck/ocr.rb
Overview
Extracts text of desired language from the image
Instance Attribute Summary collapse
-
#image_path ⇒ Object
readonly
Returns the value of attribute image_path.
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
Instance Method Summary collapse
-
#initialize(image) ⇒ Ocr
constructor
A new instance of Ocr.
- #text(lang: :eng) ⇒ Object
Constructor Details
#initialize(image) ⇒ Ocr
Returns a new instance of Ocr.
8 9 10 |
# File 'lib/despeck/ocr.rb', line 8 def initialize(image) @image_path = image end |
Instance Attribute Details
#image_path ⇒ Object (readonly)
Returns the value of attribute image_path.
6 7 8 |
# File 'lib/despeck/ocr.rb', line 6 def image_path @image_path end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
6 7 8 |
# File 'lib/despeck/ocr.rb', line 6 def lang @lang end |
Instance Method Details
#text(lang: :eng) ⇒ Object
12 13 14 |
# File 'lib/despeck/ocr.rb', line 12 def text(lang: :eng) RTesseract.new(image_path, lang: lang).to_s end |