aanred/ssocr-for-php

There is no license information available for the latest version (dev-master) of this package.

A wrapper to work with Seven Segment OCR for PHP.

dev-master 2017-02-21 03:02 UTC

This package is not auto-updated.

Last update: 2024-04-27 18:09:37 UTC


README

A wrapper to work with Seven Segment OCR for PHP. This wrapper is adoption from the one built for Tesseract OCR Tesseract OCR for PHP.

Installation

You first need to make sure you have installed OCR library for seven segment number SSOCR by auerswal.

To use this library,

$ composer require aanred/ssocr-for-php

Quick Start and Examples

Basic Usages,

$ssocr = new SSOCR('img.png');
echo $ssocr->run();

Examples,

Monochrome image (004200_mono.png)

Monochrome

$ssocr = new SSOCR('004200_mono.png');
echo $ssocr->run();
// Result
// 004200

Coloured image (004200.png)

Coloured

$ssocr = new SSOCR('004200.png');
// use iterative thresholding
$ssocr->iterativeThreshold();
// we need to crop the image so the tiny dot on the right bottom corner is not processed
$ssocr->crop(0, 0, 598, 172);
echo $ssocr->run();
// Result
// 004200

Manual threshold (inside_box.png)

Threshold

$ssocr = new SSOCR('inside_box.png');
// use manual thresholding
$ssocr->threshold(20);
// we need to crop the image to take only the boxed numbers
$ssocr->crop(230, 195, 220, 60);
echo $ssocr->run();
// Result
// 086861