forked from antoniogarrote/clj-tesseract
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
82 lines (46 loc) · 1.47 KB
/
README
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
# clj-tesseract
A Clojure wrapper for the Tesseract OCR software.
## Installation
1. Install OpenCV and Tesseract for you target platform
In OSX this can be accomplished using MacPorts.
2. Install Nakkaya's Vision library for Clojure
Instructions can be found here: http://nakkaya.com/vision.html
You need to copy the Vision .jar file to the clj-tesseract project
lib directory.
3. Compile clj-tesseract native shared library.
$ cd microcr && make
$ sudo cp libmicrocr.dylib /usr/local/lib/libmicrocr.dylib
4. Compile clj-tesseract classes
$ lein compile
5. Run the tests to check that everything is ok
$ lein test
6. Fire swank/SLIME
$ lein swank
## Usage
;; Load the library
(use 'clj-tesseract.core)
;; Load vision
(use 'vision.core)
;; Start tesseract
(def *api* (make-tesseract "/tmp"))
;; Retrieve an image from the
;; the standard webcam
(def *capture* (capture-from-cam 0))
(def *frame* (query-frame *capture*))
;; try capture
(def *text* (capture *api* *frame*))
(println (str "Captured: " *text*))
;; release resources
(clear *api*)
(release *capture*)
;; load image from file
(def *img* (load-image "./test/adam.png" :grayscale))
(view :test *img*) ; show the image in a Frame
;; try capture and clear
(println (str "Captured:" (capture *api* *img*)))
(clear *api*)
;; release Tesseract
(end *api*)
## License
Copyright (C) 2010 Antonio Garrote
Distributed under the Eclipse Public License, the same as Clojure.