Skip to content

Commit 8811b3f

Browse files
committed
First Commit
0 parents  commit 8811b3f

20 files changed

+2296
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
composer.lock

README.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Optical Mark Recognition from PHP
2+
3+
This is an open source library written in PHP for recognition markings on questionnaires scans
4+
5+
See: [https://en.wikipedia.org/wiki/Optical_mark_recognition](https://en.wikipedia.org/wiki/Optical_mark_recognition)
6+
7+
# How to use
8+
9+
Add library:
10+
11+
```sh
12+
$ composer require jansenfelipe/omr
13+
```
14+
15+
#### Scanners
16+
17+
This library needs PHP ImageMagick extension to make images of reading
18+
19+
[http://php.net/manual/en/imagick.setup.php](http://php.net/manual/en/imagick.setup.php)
20+
21+
#### Console
22+
23+
Run the following command through the image and mapping:
24+
25+
```sh
26+
$ php vendor/bin/omr scan <imageJPG> <mapJSON>
27+
```
28+
29+
Example:
30+
31+
```sh
32+
$ php vendor/bin/omr scan questionarie.jpg map.json
33+
```
34+
35+
# Map JSON
36+
37+
The map is a JSON file with image information and the positions (targets) to be recognized.
38+
39+
Example:
40+
41+
```json
42+
{
43+
"dpi": 300,
44+
"width": 2480,
45+
"height": 3508,
46+
"limits": {
47+
"topRight": {
48+
"x": 2345,
49+
"y": 140
50+
},
51+
"bottomLeft": {
52+
"x": 115,
53+
"y": 3338
54+
}
55+
},
56+
"targets": [
57+
{
58+
"y1": 430,
59+
"y2": 470,
60+
"x1": 770,
61+
"x2": 810,
62+
"id": "a1",
63+
"type": "rectangle"
64+
},
65+
{
66+
"y1": 430,
67+
"y2": 470,
68+
"x1": 860,
69+
"x2": 900,
70+
"id": "a2",
71+
"type": "rectangle"
72+
}
73+
}
74+
}
75+
```
76+
77+
# License
78+
79+
The MIT License (MIT)

bin/omr

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env php
2+
<?php
3+
include('omr.php');

bin/omr.bat

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@echo off
2+
3+
if "%PHPBIN%" == "" set PHPBIN=@php_bin@
4+
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
5+
GOTO RUN
6+
:USE_PEAR_PATH
7+
set PHPBIN=%PHP_PEAR_PHP_BIN%
8+
:RUN
9+
"%PHPBIN%" "@bin_dir@\omr" %*

bin/omr.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
require __DIR__.'/../vendor/autoload.php';
4+
5+
use JansenFelipe\OMR\Commands\ScanCommand;
6+
use Symfony\Component\Console\Application;
7+
8+
$application = new Application();
9+
$application->add(new ScanCommand());
10+
$application->run();

composer.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "jansenfelipe/orm",
3+
"description": "Optical Mark Recognition from PHP",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Jansen Felipe",
9+
"email": "jansen.felipe@gmail.com"
10+
}
11+
],
12+
"keywords": [
13+
"omr",
14+
"optical mark recognition",
15+
"survey"
16+
],
17+
"require": {
18+
"symfony/console": "^3.0"
19+
},
20+
"bin": ["bin/omr"],
21+
"require-dev": {
22+
"phpunit/phpunit": "~4.0"
23+
},
24+
"autoload": {
25+
"psr-4": {
26+
"JansenFelipe\\OMR\\": "src/"
27+
}
28+
},
29+
"minimum-stability": "dev"
30+
}

0 commit comments

Comments
 (0)