Setting the OcrEngine to Automatically Detect the Text Blocks in PHP

Aspose.OCR - Setting the OcrEngine to Automatically Detect the Text Blocks

To Set the OcrEngine to Automatically Detect the Text Blocks using Aspose.OCR Java for PHP, simply invoke DetectTextBlocks module. Here you can see example code.

PHP Code

## Initialize an instance of OcrEngine

$ocr_engine = new OcrEngine();

\# Set the Image property by loading the image from file path location

$imageStream=new ImageStream();

$ocr_engine->setImage($imageStream->fromFile($dataDir . 'ocr.png'));

\# Set the DetectTextRegions to true

$ocr_engine->getConfig()->setDetectTextRegions(true);

\# Process the image

if ($ocr_engine->process()){

\# Display the result

print "Text: " . (string)$ocr_engine->getText().PHP_EOL;

}

Download Running Code

Download Setting the OcrEngine to Automatically Detect the Text Blocks (Aspose.OCR) from any of the below mentioned social coding sites: