devcafeimers/textdetector

PHP Text Detection from Image

v1.0.0 2018-06-30 18:18 UTC

This package is not auto-updated.

Last update: 2024-04-14 02:50:56 UTC


README

Requirements

  • PHP 5.6 or ^7.1
  • Tesseract

Installation

$ composer require cafeimers/textdetector

‼️ This library depends on Tesseract OCR, version 3.03 or later.


Note for Windows users

There are [many ways][tesseract_installation_on_windows] to install Tesseract OCR on your system, but if you just want something quick to get up and running, I recommend installing the Capture2Text package with Chocolatey.

	choco install capture2text --version 3.9

⚠️ Recent versions of Capture2Text stopped shipping the tesseract binary.


Note for macOS users

With MacPorts you can install support for individual languages, like so:

	$ sudo port install tesseract-<langcode>

But that is not possible with Homebrew. It comes only with English support by default, so if you intend to use it for other language, the quickest solution is to install them all:

	$ brew install tesseract --with-all-languages

Note for Linux/Ubuntu users

$ sudo apt-get install tesseract

Usage

Example 1

<?php

use Cafeimers\Detector\DetectTextFromImage;

require_once 'path/to/vendor/autoload.php';

dump( DetectTextFromImage::Detection('buktitransferbri.jpg', [
	'34530102751333',
	'030301015869506',
	'1370010500300'
]) );

// return true or false

Example 2

<?php

use Cafeimers\Detector\DetectTextFromImage;

require_once 'path/to/vendor/autoload.php';

$collections = ['34530102751333','030301015869506','1370010500300'];
dump( DetectTextFromImage::Detection('buktitransferbri.jpg', $collections) );

// return true or false