Sha256: 474bf07045891bf07172a1243786ddcc393957682c913ce5aa5f8077f898c320
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
module Asposeocrjava module ReadPartInformationOfText 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')) # Process the image if ocr_engine.process() # Display the recognized text puts "Text: " + ocr_engine.getText().to_string # Retrieve an array of recognized text by parts text = ocr_engine.getText().getPartsInfo() # Iterate over the text parts i = 0 while i < text.length symbol = text[i] # Display part information puts "isItalic : " + symbol.getItalic().to_s puts "isUnderline : " + symbol.getUnderline().to_s puts "isBold : " + symbol.getBold().to_s puts "Text Color : " + symbol.getTextColor().to_string puts "Quality : " + symbol.getCharactersQuality().to_s i +=1 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
asposeocrjava-0.0.1 | lib/asposeocrjava/OCR/readpartinformationoftext.rb |