Module: Kreuzberg::OcrBoundingGeometry
- Extended by:
- T::Helpers, T::Sig
- Included in:
- OcrBoundingGeometryQuadrilateral, OcrBoundingGeometryRectangle
- Defined in:
- lib/kreuzberg/native.rb
Overview
Bounding geometry for an OCR element.
Supports both axis-aligned rectangles (from Tesseract) and 4-point quadrilaterals (from PaddleOCR and rotated text detection).
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
4123 4124 4125 4126 4127 4128 4129 4130 |
# File 'lib/kreuzberg/native.rb', line 4123 def self.from_hash(hash) discriminator = hash[:type] || hash["type"] case discriminator when "rectangle" then OcrBoundingGeometryRectangle.from_hash(hash) when "quadrilateral" then OcrBoundingGeometryQuadrilateral.from_hash(hash) else raise "Unknown discriminator: #{discriminator}" end end |