2017 © Pedro Peláez
 

library omr

Optical Mark Recognition from PHP

image

jansenfelipe/omr

Optical Mark Recognition from PHP

  • Thursday, July 6, 2017
  • by jansenfelipe
  • Repository
  • 12 Watchers
  • 73 Stars
  • 201 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 29 Forks
  • 6 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

Optical Mark Recognition with PHP

Latest Stable Version Total Downloads Latest Unstable Version MIT license Build Status, (*1)

This is an open source library written in PHP for recognition markings on questionnaires scans, (*2)

See: https://en.wikipedia.org/wiki/Optical_mark_recognition, (*3)

, (*4)

How to use

Add library:, (*5)

$ composer require jansenfelipe/omr

Instantiate the Scanner class responsible for reading the image and enter its path, (*6)

/*
 * Setup scanner
 */
$scanner = new ImagickScanner();
$scanner->setImagePath($imagePath);

You will need to scan a blank form and create the Target Mapping File to be able to use the library., (*7)

After creating the map.json file, enter its path:, (*8)

/*
 * Setup map
 */
$map = MapJson::create($mapJsonPath);

Now you can scan and get the result, (*9)

$result = $scanner->scan($map);

Scanners

This library currently has only one scanner class using Imagemagick 6. It has been tested using the following configurations:, (*10)

  • PHP 7.3
  • imagemagick6
  • Extension imagick-3.4.4

See https://github.com/jansenfelipe/omr/blob/master/src/Scanners/ImagickScanner.php, (*11)

Target Mapping File

It is a .json file that describes, in addition to the image information, the coordinates of the places (targets) that the script must do the pixel analysis. This file follows the following pattern:, (*12)

{
    "width": 600,
    "height": 800,
    "targets": [
      {
        "x1": 50,
        "y1": 43,
        "x2": 65,
        "y2": 57,
        "id": "Foo",
        "type": "rectangle",
        "tolerance": 60
      }
    ] 
}

Example

In the example directory there is an image of a completed questionnaire response.png. There is also a map.json file that gives the coordinates of the image areas that will be analyzed the pixels., (*13)

To help with setting up the environment, there is a Dockerfile in the project based on the official PHP 7.3 image that adds composer, imagemagick and the imagick extension to PHP., (*14)

That way you can install the dependencies and run the command to process the image without headaches :), (*15)

1) Clone this repo:, (*16)

$ git clone https://github.com/jansenfelipe/omr.git
$ cd omr/

2) Install dependencies:, (*17)

$ docker-compose run php composer install

2) Process example image:, (*18)

$ docker-compose run php bin/omr scan example/response.png example/map.json

License

The MIT License (MIT), (*19)

The Versions

06/07 2017

1.0.x-dev

1.0.9999999.9999999-dev

Optical Mark Recognition from PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jansen Felipe

survey omr optical mark recognition

06/07 2017

1.0.0

1.0.0.0

Optical Mark Recognition from PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jansen Felipe

survey omr optical mark recognition

24/02 2016

dev-master

9999999-dev

Optical Mark Recognition from PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jansen Felipe

survey omr optical mark recognition