Class: Xberg::OcrBoundingGeometryRectangle

Inherits:
Data
  • Object
show all
Extended by:
T::Sig
Includes:
OcrBoundingGeometry
Defined in:
lib/xberg/native.rb

Overview

Axis-aligned bounding box (typical for Tesseract output).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#heightObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



4120
4121
4122
# File 'lib/xberg/native.rb', line 4120

def height
  @height
end

#leftObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



4120
4121
4122
# File 'lib/xberg/native.rb', line 4120

def left
  @left
end

#topObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



4120
4121
4122
# File 'lib/xberg/native.rb', line 4120

def top
  @top
end

#widthObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



4120
4121
4122
# File 'lib/xberg/native.rb', line 4120

def width
  @width
end

Class Method Details

.from_hash(hash) ⇒ Object



4147
4148
4149
4150
4151
4152
4153
4154
# File 'lib/xberg/native.rb', line 4147

def self.from_hash(hash)
  new(
    left: hash[:left] || hash["left"],
    top: hash[:top] || hash["top"],
    width: hash[:width] || hash["width"],
    height: hash[:height] || hash["height"]
  )
end

Instance Method Details

#quadrilateral?Boolean

Returns:

  • (Boolean)


4143
4144
4145
# File 'lib/xberg/native.rb', line 4143

def quadrilateral? = false
# @param hash [Hash] deserialized from the native extension
# @return [self]

#rectangle?Boolean

Returns:

  • (Boolean)


4141
# File 'lib/xberg/native.rb', line 4141

def rectangle? = true