-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathINSTALL.txt
307 lines (192 loc) · 8.7 KB
/
INSTALL.txt
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
This file describes how to install and compile libcrn on Linux, MacOS, Windows and Android.
-------------------------------------------------------------------------------------------
The main dependencies are:
- CMake >= 2.8.9 (required)
- gettext (required)
- libiconv (required only for Windows, already in the system on Linux and MacOS)
- libjpeg (optional, to load and save images)
- libpng (optional, to load and save images)
- libzip (optional, to create archives)
- libHaru (optional, to create PDF files)
- OpenCV (optional, used for 'crn2opencv2crn' demo)
- Gtkmm 2 or Gtkmm 3 (optional, Gtkmm 2 preferred, used for GUI)
- Qt 4 or 5 (optional, but only used for 'future ? GUI')
- Doxygen and Graphviz (optional, used to generate the documentation)
CMake compilation flags summary:
- CMAKE_BUILD_TYPE: build type (Release or Debug)
- CRN_DEPENDENCY_GETTEXT_INTL: use gettext and libintl to translate messages (ON or OFF)
- CRN_DEPENDENCY_GDIPLUS: --> ONLY FOR Windows <--, use Gdi+ to load and save images (ON or OFF)
- CRN_DEPENDENCY_GDKPIXBUF: use GdkPixbuf to load and save images (ON or OFF)
- CRN_DEPENDENCY_JPEG: use libjpeg to load and save images (ON or OFF)
- CRN_DEPENDENCY_PNG: use libpng to load and save images (ON or OFF)
- CRN_DEPENDENCY_ZIP: use libzip to create archives (ON or OFF)
- CRN_DEPENDENCY_HARUPDF: use libHaru to create PDF files (ON or OFF)
- CRN_DEPENDENCY_OPENCV: use OpenCV for 'crn2opencv2crn' demo (ON or OFF)
- CRN_DEPENDENCY_GTKMM2: use GUI (ON or OFF)
1) Linux
--------
* Install dependencies *
------------------------
Example on Ubuntu 14.04 amd64:
# CMake
$ sudo aptitude install cmake
# gettext
$ sudo aptitude install gettext
# libzip
$ sudo aptitude install libzip-dev
# libHaru
$ sudo aptitude install libhpdf-dev
# OpenCV
$ sudo aptitude install libopencv-dev
# Gtkmm 2
$ sudo aptitude install libgtkmm-2.4-dev
# Qt 4
$ sudo aptitude install libqt4-dev
# Doxygen and Graphviz
$ sudo aptitude install doxygen graphviz
* Compile *
-----------
Compile libcrn:
# get libcrn source code
$ git clone https://github.com/Liris-Pleiad/libcrn.git
# create build directory
$ cd libcrn && mkdir build && cd build
# compile with GUI (here with Gtkmm 2), libzip and libHaru
$ cmake -DCRN_DEPENDENCY_GTKMM2=ON -DCRN_DEPENDENCY_ZIP=ON -DCRN_DEPENDENCY_HARUPDF=ON -DCMAKE_BUILD_TYPE=Release ..
$ make
# compile without GUI (default behavior) but with OpenCV demo
$ cmake -DCRN_DEPENDENCY_OPENCV=ON -DCMAKE_BUILD_TYPE=Release ..
$ make
# generate the documentation
$ make doc
* Run tests *
-------------
$ ctest
2) MacOS
--------
* Install dependencies *
------------------------
# install homebrew package manager (see http://brew.sh/), then
$ brew update
# CMake
$ brew install cmake
# gettext
$ brew install gettext intltool
# libzip
$ brew install libzip
# libHaru
$ brew install libharu
# OpenCV
$ brew install homebrew/science/opencv
# Gtkmm 2
$ brew install gtkmm
# Qt 4
$ brew install cartr/qt4/qt
# Doxygen and Graphviz
$ brew install doxygen graphviz
* Compile *
-----------
# get libcrn source code (see Linux section above)
# create build directory (see Linux section above)
# compile with GUI (here with Gtkmm 2), libzip and libHaru (see Linux section above)
# compile without GUI (default behavior) but with OpenCV demo (see Linux section above)
# generate the documentation (see Linux section above)
* Run tests *
-------------
$ ctest
3) Windows
----------
* Prerequisites *
-----------------
- Update Windows 7/8/8.1/10 (services packs and Windows Update)
- download and install Visual Studio Express 2015 from
https://download.gforge.liris.cnrs.fr/meppbin/windows/vs2015/Visual%20Studio%20Express%202015/Visual%20Studio%20Express%202015%20pour%20Windows%20Desktop.rar
(download size 7.4 Go, installation size ~>14 Go)
* Install dependencies *
------------------------
- download the 'core' binary kit for VS2015_64 from
https://download.gforge.liris.cnrs.fr/meppbin/windows/vs2015/PLEIAD/kits/PLEIAD_local_vs2015_64.7z
(download size 918 Mo, installation size ~7.4 Go)
- extract the 'core' binary kit 'PLEIAD_local_vs2015_64.7z'; ensure that the absolute path to the 'local_vs2015_64' directory is short (less than 50 characters) and does NOT contain any whitespace (troubles have been encountered with 'Mes Documents' for example)
- extract CMake 3.4.3 from 'local_vs2015_64\_utils_\cmake-3.4.3-win32-x86.zip'
- set a new user environment variable 'MSVC_KIT_ROOT' to 'path_to/local_vs2015_64' (beware of the directory separator, it must be '/' here)
- add ';path_to\local_vs2015_64\_bin_' to the PATH system environment variable, just after the Windows system paths, but before any other path, in order to avoid a library version conflict; beware of the ';' path separator
* Compile *
-----------
- get libcrn source code using your favourite Git client (https://tortoisegit.org/) and this url : https://github.com/Liris-Pleiad/libcrn.git
- run CMake GUI
- choose 'Visual Studio 14 2015 Win64' as the compiler version
- where is the source code = ".../libcrn"
- where to build the binaries = ".../libcrn/build"
- set the CMake compilation flags as needed (see list above)
- click "Configure"
- click "Generate"
- open "libcrn/build/libcrn.sln" solution with MSVC 2015, select 'Release' mode, then generate the 'ALL_BUILD' project
* Run tests *
-------------
- open "libcrn/build/libcrn.sln" solution with MSVC 2015, then generate the 'RUN_TESTS' project
4) Android
----------
* Install dependencies *
------------------------
# Android NDK
- download and extract the Android NDK for your platform (Windows, MacOS or Linux) from https://developer.android.com/ndk/downloads
# (Optional) Android Studio
- download and install the Android Studio for your platform (Windows, MacOS or Linux) from https://developer.android.com/studio needed to obtain The Android Emulator (install all features: Android Studio, Android SDK, Android Virtual Device and also Hardware Acceleration)
a) from Linux (example on Ubuntu 14.04 amd64):
# CMake
$ sudo aptitude install cmake
b) from MacOS
# install homebrew package manager (see http://brew.sh/), then
$ brew update
# CMake
$ brew install cmake
c) from Windows
# CMake
- download and extract CMake 3.4.3 from https://cmake.org/files/v3.4/cmake-3.4.3-win32-x86.zip
# Ninja (a 'really good' port of make)
- download and extract Ninja 1.7.2 from https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip
* Compile *
-----------
# get libcrn source code (see Linux section above)
# create build directory (see Linux section above)
# compile (from Linux or MacOS)
$ cmake -DANDROID_NDK=absolute_path_to_ndk -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=../cmake/android/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=9 .. (-> here ANDROID_ABI=x86 is an example)
$ make
# compile (from Windows)
$ absolute_path_to_cmake\cmake -DANDROID_NDK=absolute_path_to_ndk -DANDROID_ABI=x86 -GNinja -DCMAKE_MAKE_PROGRAM=absolute_path_to_ninja\ninja -DCMAKE_TOOLCHAIN_FILE=../cmake/android/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=9 .. (-> here ANDROID_ABI=x86 is an example)
$ absolute_path_to_ninja\ninja
* Run tests *
-------------
Launch an emulator:
```
$ emulator -list-avds (-> list all available avds)
$ emulator -avd Nexus_5X_API_25_x86 -wipe-data -no-boot-anim & (-> here Nexus_5X_API_25_x86 is an example)
$ adb devices (-> list of devices attached)
```
Deploy and test:
```
$ adb push out/libcrn.so /sdcard/
$ adb push out/tests /sdcard/
$ adb root
$ adb shell
$ cd /data/local
$ cp /sdcard/libcrn.so .
$ chmod 751 libcrn.so
$ cp /sdcard/tests .
$ chmod 751 tests
$ LD_LIBRARY_PATH=. ./tests
```
5) Documentation
----------------
The automatically generated documentation is available here: https://liris.cnrs.fr/pleiad/doc/nightly/
6) Simple examples and demos
----------------------------
See './libcrn/src/demos' folder:
- estimateStrokes.cpp
- ocr4dummies.cpp (a quick OCR engine to recognize capital roman letters, to keep the example short, it is designed for old Latin documents that have no spacing between words and have well separated lines of text)
- crn2opencv2crn.cpp (CRN_DEPENDENCY_OPENCV must be set to ON for this demo)
7) Known issues
---------------
* On Windows, when using CMake with CRN_DEPENDENCY_HARUPDF and CRN_DEPENDENCY_PNG set to ON at the same time, for now you must do 'Configure' 2 times because at the first time you will have a 'false' PNG error: 'Could NOT find PNG'.
* On MacOS, you can't use CMake with CRN_DEPENDENCY_GETTEXT_INTL set to ON because for now gettext is not found.