-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.php
68 lines (56 loc) · 1.03 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
include "ImageLayout.php";
include "BinaryImage.php";
set_time_limit ( 1000 );
$as = $_GET["as"];
$url = $_GET["url"];
$top = $_GET["t"];
$bottom = $_GET["b"];
$left = $_GET["l"];
$right = $_GET["r"];
$threshold = $_GET["thresh"];
$lh = $_GET["lh"];
$numLines = $_GET["lnum"];
if (isset($url)){
if (!(isset($top))){
$top = 200;
}
if (!(isset($bottom))){
$bottom = 1900;
}
if (!(isset($right))){
$right = 1500;
}
if (!(isset($left))){
$left = 500;
}
if (!(isset($threshold))){
$threshold = 90;
}
if (!(isset($lh))){
$lh = 20;
}
if (!(isset($lnum))){
$lnum = 38;
}
$iocr = new imageOCR();
$dims = array("top"=>$top,"bottom"=>$bottom,"right"=>$right,"left"=>$left);
$iocr->LoadImg($url,$threshold,$dims);
$targetsize = $lnum;
$gap = $lh;
if ($as=="d"){
$iocr->printLines();
}
else{
$iocr->threshold=70;
$iocr->binarize();
header('Content-type: image/jpeg');
$redlines = $iocr->getLines();
$iocr->displayLines($redlines);
$iocr->showImage();
}
}
else{
echo "You must supply a url to an image in the url paramater [url=ham.jpg].";
}
?>