Sha256: 58b03f5cdf022c4c03d797b8d8f4f4db627c2d8dd299ca8a002799793d0ea607

Contents?: true

Size: 780 Bytes

Versions: 1

Compression:

Stored size: 780 Bytes

Contents

module Asposeocrjava
  module DetectTextBlocks
    def initialize()
        data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
                
        # Initialize an instance of OcrEngine
        ocr_engine = Rjb::import('com.aspose.ocr.OcrEngine').new

        # Set the Image property by loading the image from file path location
        ocr_engine.setImage(Rjb::import('com.aspose.ocr.ImageStream').fromFile(data_dir + 'ocr.png'))

        # Set the DetectTextRegions to true
        ocr_engine.getConfig().setDetectTextRegions(true)

        # Process the image
        if ocr_engine.process()
            # Display the result
            puts "Text: " + ocr_engine.getText().to_string
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asposeocrjava-0.0.1 lib/asposeocrjava/OCR/detecttextblocks.rb