-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathindex.html
171 lines (133 loc) · 7.28 KB
/
index.html
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JavaScript OCR demo</title>
<meta name="Description" content="Optical Character Recognition demo in JavaScript"/>
<meta property="og:image" content="http://kdzwinel.github.io/JS-OCR-demo/img/process.png"/>
<link rel="image_src" href="http://kdzwinel.github.io/JS-OCR-demo/img/process.png"/>
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/jquery.Jcrop.min.css"/>
<link rel="stylesheet" href="css/main.css"/>
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-145083566-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="step1">
<div class="container">
<div class="alert alert-danger"><strong>Oops!</strong> <span></span></div>
<div class="jumbotron">
<div id="step1">
<h1><i class="glyphicon glyphicon-camera"></i></h1>
<p class="lead">
Take a good picture of a huge, printed text.
<i class="glyphicon glyphicon-question-sign help" data-placement="bottom"
data-content="<img src='img/step1.png' />" data-html="true"></i>
</p>
<figure class="not-ready">
<video autoplay></video>
</figure>
<button class="btn btn-lg btn-success" disabled id="takePicture">Take a picture</button>
</div>
<div id="step2">
<h1><i class="glyphicon glyphicon-pencil"></i></h1>
<p class="lead">
Crop the picture and adjust it so that text is clearly visible.
<i class="glyphicon glyphicon-question-sign help" data-placement="bottom"
data-content="<img src='img/step2.png' />" data-html="true"></i>
</p>
<figure>
<canvas style="display:none"></canvas>
<img src=""/>
</figure>
<p>Brightness: <input type="range" min="0" max="100" id="brightness" value="20"></p>
<p>Contrast: <input type="range" min="0" max="100" id="contrast" value="90"></p>
<button class="btn btn-lg btn-success" id="adjust" disabled>Done</button>
</div>
<div id="step3">
<h1><i class="glyphicon glyphicon-text-height"></i></h1>
<p class="lead">You'll find the recognized text below.</p>
<figure>
<canvas></canvas>
</figure>
<blockquote>
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
<p id="result"></p>
<footer></footer>
</blockquote>
<button class="btn btn-lg btn-default" id="go-back">Go back</button>
<button class="btn btn-lg btn-default" id="start-over">Start over</button>
</div>
</div>
<div class="header">
<ul class="nav nav-pills pull-right">
<li class="active"><a href="#" data-step="1">#1 <i class="glyphicon glyphicon-camera"></i></a></li>
<li class="disabled"><a href="#" data-step="2">#2 <i class="glyphicon glyphicon-pencil"></i></a></li>
<li class="disabled"><a href="#" data-step="3">#3 <i class="glyphicon glyphicon-text-height"></i></a></li>
</ul>
<h3 class="text-muted">JavaScript OCR demo</h3>
</div>
<div class="row marketing">
<div class="col-lg-6">
<h4>Step #1 - MediaDevices.getUserMedia()</h4>
<p>MediaDevices.getUserMedia is a browser API that allows web apps to access user's camera and microphone. Read more on <a
href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia">MDN</a>.</p>
<h4>Step #2 - glfx.js, JCrop</h4>
<p><a href="https://github.com/evanw/glfx.js/">glfx.js</a> was used for image effects (sharpening, contrast,
etc.). Cropping functionality (with touch support) is provided by jQuery plugin <a
href="https://github.com/tapmodo/Jcrop">Jcrop</a>.</p>
<h4>Step #3 - Tesseract.js</h4>
<p><a href="http://tesseract.projectnaptha.com/">Tesseract.js</a> was used for OCR (Optical Character
Recognition). It is a javascript version of the <a
href="https://github.com/tesseract-ocr/tesseract">Tesseract Open Source OCR Engine</a>.</p>
<h4>More…</h4>
<p>I've made two short videos about this project: <a href="https://www.youtube.com/watch?v=9TzXcBBC1J8">one that describes how this was built</a> and <a href="https://www.youtube.com/watch?v=ttn437BlEbo">the other one that demonstrates how it works</a>. Hopefully, the source code is also quite readable.</p>
</div>
<div class="col-lg-6">
<h4>Support</h4>
<p>This demo requires <a href="http://caniuse.com/stream">getUserMedia</a> and <a
href="http://caniuse.com/webgl">WebGL</a>. It should work (as for 03.2014) on Chrome, Firefox and
Opera. Both desktop and mobile.</p>
<h4>Source code</h4>
<p>This demo is open source, and is hosted on <a href="https://github.com/kdzwinel/JS-OCR-demo">GitHub</a>.
Feel free to fork it, report issues and share your ideas for improvements.</p>
<h4>Social media</h4>
<!-- Github button -->
<iframe src="https://ghbtns.com/github-btn.html?user=kdzwinel&repo=JS-OCR-demo&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe>
</div>
</div>
<div class="footer">
<p>
Konrad Dzwinel ·
<a href="https://github.com/kdzwinel"><i class="fa fa-github"></i></a> ·
<a href="http://stackoverflow.com/users/1143495/konrad-dzwinel"><i class="fa fa-stack-overflow"></i></a> ·
<a href="http://www.linkedin.com/pub/konrad-dzwinel/53/599/366/en"><i class="fa fa-linkedin"></i></a> ·
<a href="https://twitter.com/kdzwinel"><i class="fa fa-twitter"></i></a>
</p>
</div>
</div>
<!-- /container -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/vendor/modernizr.min.js"></script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="js/vendor/jquery.Jcrop.js"></script>
<script src='https://cdn.jsdelivr.net/gh/naptha/[email protected]/dist/tesseract.min.js'></script>
<script src="js/vendor/glfx.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>