Class: Iguvium::CV
- Inherits:
-
Object
- Object
- Iguvium::CV
- Defined in:
- lib/iguvium/cv.rb
Overview
Performs all the computer vision job except table composition. Edge detection is performed using simplified two-directional version of Canny edge detection operator applied to rows and columns as integer vectors
Defined Under Namespace
Classes: Recognized
Instance Attribute Summary collapse
-
#blurred ⇒ Object
readonly
Returns the value of attribute blurred.
-
#boxes ⇒ Array<Range, Range>
writeonly
X range, Y range.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#lines ⇒ Hash
writeonly
:vertical and :horizontal lines.
Instance Method Summary collapse
-
#initialize(image) ⇒ CV
constructor
Prepares image for recognition: initial blur.
-
#recognize ⇒ Recognized
Lines most probably forming table cells and tables’ outer borders as boxes.
Constructor Details
#initialize(image) ⇒ CV
Prepares image for recognition: initial blur
41 42 43 44 |
# File 'lib/iguvium/cv.rb', line 41 def initialize(image) = blur(image) @image = to_narray(image).to_a end |
Instance Attribute Details
#blurred ⇒ Object (readonly)
Returns the value of attribute blurred.
46 47 48 |
# File 'lib/iguvium/cv.rb', line 46 def end |
#boxes=(value) ⇒ Array<Range, Range>
Returns X range, Y range.
|
|
# File 'lib/iguvium/cv.rb', line 30
|
#image ⇒ Object (readonly)
Returns the value of attribute image.
46 47 48 |
# File 'lib/iguvium/cv.rb', line 46 def image @image end |
#lines=(value) ⇒ Hash
Returns :vertical and :horizontal lines. Horizontal lines are [Array<Range, Integer>], vertical have [Integer] on x position.
|
|
# File 'lib/iguvium/cv.rb', line 30
|
Instance Method Details
#recognize ⇒ Recognized
Returns lines most probably forming table cells and tables’ outer borders as boxes.
50 51 52 53 54 55 56 |
# File 'lib/iguvium/cv.rb', line 50 def recognize Recognized.new(lines, boxes) # { # lines: lines, # boxes: boxes # } end |