Commit 28db22f33eaa87b46e3588246b97e5d03036c62c

Authored by Nei Jobson da Costa Carneiro
1 parent d2b74559

Atualização do README.md

Showing 1 changed file with 97 additions and 96 deletions   Show diff stats
@@ -39,24 +39,22 @@ Author: Guilherme Chehab @@ -39,24 +39,22 @@ Author: Guilherme Chehab
39 - Add support for stencil type and image encoding scans, changed default extraction method for unknown types/encodings 39 - Add support for stencil type and image encoding scans, changed default extraction method for unknown types/encodings
40 - Fix: create subpaths on error folder 40 - Fix: create subpaths on error folder
41 - Fix: trying to reduce overhead on temporary folder 41 - Fix: trying to reduce overhead on temporary folder
42 - - TODO:  
43 - - Changes get_imgs and OCR processing to enable pages with more than one image -- it would not work on previous versions that assumed #pages = #imgs. Version 1.0.1 counts them diferently but does not treat it adequately -- shall require better pdf´s internal structure handling  
44 - - Review poppler and cpdf install instructions  
45 - - Add better handling of vectorized and non scanned pdf files  
46 - - Add option to generate multi-page tiff files to reduce overhead (one for each CPU core) -- harder with current scalling, cropping and rotation handlers  
47 - - Check mean saturation for additional colored images detection and automatically convert to B&W if possible -- added function to analyse image color histogram -> just need to add option to convert it to B&W.  
48 - - Move all parameters to config file  
49 - - Add some job control web interface  
50 - - Add end user interface to submit files through web  
51 - - Add check external programs version requirements before running  
52 - - BUGS:  
53 - - When image is of type stencil or encoding image, cropping information is lost, and page is shown different than original, this is due to using pdftoppm instead of pdfimages  
54 -  
55 -## Check software requirements on the comments bellow  
56 -  
57 -To configure input dirs change @BASE_DIRS and @SUB_DIRS variables  
58 -  
59 -### O servidor OCR depende dos seguintes componentes: 42 +
  43 +## TODO:
  44 + - Changes get_imgs and OCR processing to enable pages with more than one image -- it would not work on previous versions that assumed #pages = #imgs. Version 1.0.1 counts them diferently but does not treat it adequately -- shall require better pdf´s internal structure handling
  45 + - Review poppler and cpdf install instructions
  46 + - Add better handling of vectorized and non scanned pdf files
  47 + - Add option to generate multi-page tiff files to reduce overhead (one for each CPU core) -- harder with current scalling, cropping and rotation handlers
  48 + - Check mean saturation for additional colored images detection and automatically convert to B&W if possible -- added function to analyse image color histogram -> just need to add option to convert it to B&W.
  49 + - Move all parameters to config file
  50 + - Add some job control web interface
  51 + - Add end user interface to submit files through web
  52 + - Add check external programs version requirements before running
  53 +
  54 +## BUGS:
  55 + - When image is of type stencil or encoding image, cropping information is lost, and page is shown different than original, this is due to using pdftoppm instead of pdfimages
  56 +
  57 +## Requirements:
60 - Perl 5.10.1, com seguintes módulos: 58 - Perl 5.10.1, com seguintes módulos:
61 - File::Find::Rule 59 - File::Find::Rule
62 - File::Basename 60 - File::Basename
@@ -74,7 +72,7 @@ To configure input dirs change @BASE_DIRS and @SUB_DIRS variables @@ -74,7 +72,7 @@ To configure input dirs change @BASE_DIRS and @SUB_DIRS variables
74 - Cpdf 2.1 72 - Cpdf 2.1
75 - ImageMagick 6.7.2-7 73 - ImageMagick 6.7.2-7
76 - Ghostcript 9.18 74 - Ghostcript 9.18
77 - 75 +
78 Na ausência deles na distribuição do sistema operacional, o uso de versões antigas desses componentes podem comprometer o correto funcionamento do sistema 76 Na ausência deles na distribuição do sistema operacional, o uso de versões antigas desses componentes podem comprometer o correto funcionamento do sistema
79 77
80 Dessa forma, pode ser necessário compilar os componentes faltantes, assim como as bibliotecas necessárias para o seu correto funcionamento. 78 Dessa forma, pode ser necessário compilar os componentes faltantes, assim como as bibliotecas necessárias para o seu correto funcionamento.
@@ -107,7 +105,7 @@ Quanto ao CPDF, é possível baixar a versão binária em: https://github.com/co @@ -107,7 +105,7 @@ Quanto ao CPDF, é possível baixar a versão binária em: https://github.com/co
107 105
108 ## Compilando os pré-requisitos: máquina de COMPILAÇÃO APENAS 106 ## Compilando os pré-requisitos: máquina de COMPILAÇÃO APENAS
109 107
110 -### RedHat 6.7 e Centos 6.9: 108 + # RedHat 6.7 e Centos 6.9:
111 yum -y install autoconf make gcc-java gcc gcc-c++ subversion pkg-config automake libtool yasm cmake git libgcj unzip 109 yum -y install autoconf make gcc-java gcc gcc-c++ subversion pkg-config automake libtool yasm cmake git libgcj unzip
112 yum -y install libtiff-devel libpng-devel openjpeg-devel libjpeg-turbo-devel giflib-devel libwebp-devel zlib-devel libicu-devel pango-devel cairo-devel fontconfig-devel gettext-devel libcurl-devel nss-devel 110 yum -y install libtiff-devel libpng-devel openjpeg-devel libjpeg-turbo-devel giflib-devel libwebp-devel zlib-devel libicu-devel pango-devel cairo-devel fontconfig-devel gettext-devel libcurl-devel nss-devel
113 cd /tmp 111 cd /tmp
@@ -115,21 +113,21 @@ Quanto ao CPDF, é possível baixar a versão binária em: https://github.com/co @@ -115,21 +113,21 @@ Quanto ao CPDF, é possível baixar a versão binária em: https://github.com/co
115 rpm -Uvh msttcore-fonts-2.0-3.noarch.rpm 113 rpm -Uvh msttcore-fonts-2.0-3.noarch.rpm
116 rm -f msttcore-fonts-2.0-3.noarch.rpm 114 rm -f msttcore-fonts-2.0-3.noarch.rpm
117 115
118 -### Centos 6.9  
119 -# \_ autoconf-archive 116 + # Centos 6.9
  117 + # \_ autoconf-archive
120 wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/pelliott11:/autoconf-archive/CentOS_CentOS-6/noarch/autoconf-archive-2012.04.07-7.3.noarch.rpm 118 wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/pelliott11:/autoconf-archive/CentOS_CentOS-6/noarch/autoconf-archive-2012.04.07-7.3.noarch.rpm
121 rpm -i autoconf-archive-2012.04.07-7.3.noarch.rpm 119 rpm -i autoconf-archive-2012.04.07-7.3.noarch.rpm
122 rm autoconf-archive-2012.04.07-7.3.noarch.rpm 120 rm autoconf-archive-2012.04.07-7.3.noarch.rpm
123 -# \_ GCC 4.8 121 + # \_ GCC 4.8
124 wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo 122 wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
125 yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ devtoolset-2-gcj 123 yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ devtoolset-2-gcj
126 124
127 -# Ubuntu 14.04 Server: 125 + # Ubuntu 14.04 Server:
128 apt-get install build-essential cmake libtool yasm pkg-config subversion git libgcj14 126 apt-get install build-essential cmake libtool yasm pkg-config subversion git libgcj14
129 apt-get install libtiff-dev libpng-dev libopenjpeg-dev libjpeg8-dev libjpeg-turbo8-dev libjpeg-dev libgif-dev zlib1g-dev libicu-dev libpango1.0-dev libcairo2-dev libfontconfig1-dev libgettextpo-dev libcurl-dev libnss3-dev 127 apt-get install libtiff-dev libpng-dev libopenjpeg-dev libjpeg8-dev libjpeg-turbo8-dev libjpeg-dev libgif-dev zlib1g-dev libicu-dev libpango1.0-dev libcairo2-dev libfontconfig1-dev libgettextpo-dev libcurl-dev libnss3-dev
130 apt-get install ttf-mscorefonts-installer 128 apt-get install ttf-mscorefonts-installer
131 129
132 -# Ambas plataformas: 130 + # Ambas plataformas:
133 cd /usr/local/src 131 cd /usr/local/src
134 132
135 for i in \ 133 for i in \
@@ -152,89 +150,92 @@ Quanto ao CPDF, é possível baixar a versão binária em: https://github.com/co @@ -152,89 +150,92 @@ Quanto ao CPDF, é possível baixar a versão binária em: https://github.com/co
152 unzip pdftk-2.02-src.zip 150 unzip pdftk-2.02-src.zip
153 rm -f pdftk-2.02-src.zip 151 rm -f pdftk-2.02-src.zip
154 152
155 -# pdftk, versão 2.02 ou superior  
156 -cd pdftk-2.02-dist/pdftk && make -f Makefile.Redhat all install && cd ../.. 153 + # pdftk, versão 2.02 ou superior
  154 + cd pdftk-2.02-dist/pdftk && make -f Makefile.Redhat all install && cd ../..
157 155
158 -# Ghostscript 9.18 ou superior  
159 -#wget http://downloads.ghostscript.com/public/old-gs-releases/ghostscript-9.18.tar.gz  
160 -#tar xvozf ghostscript-9.21.tar.gz  
161 -#rm -f ghostscript-9.21.tar.gz  
162 -#cd ghostscript-9.21  
163 -cd ghostpdl  
164 -./autogen.sh; ./configure  
165 -make all install  
166 -cd .. 156 + # Ghostscript 9.18 ou superior
  157 + #wget http://downloads.ghostscript.com/public/old-gs-releases/ghostscript-9.21.tar.gz
  158 + #tar xvozf ghostscript-9.21.tar.gz
  159 + #rm -f ghostscript-9.21.tar.gz
  160 + #cd ghostscript-9.21
  161 + cd ghostpdl
  162 + ./autogen.sh; ./configure
  163 + make all install
  164 + cd ..
167 165
168 -# Centos 6.9  
169 -# \_ Cria um novo shell usando o GCC 4.8 por default  
170 -scl enable devtoolset-2 bash 166 + # Centos 6.9
  167 + # \_ Cria um novo shell usando o GCC 4.8 por default
  168 + scl enable devtoolset-2 bash
171 169
172 -# Tesseract, versão 3.05-dev ou superior  
173 -# Bibliotecas para o Tesseract: Leptonica e Libav  
174 -cd leptonica && ./autobuild && ./configure && make all install && cd .. 170 + # Tesseract, versão 3.05-dev ou superior
  171 + # Bibliotecas para o Tesseract: Leptonica e Libav
  172 + cd leptonica && ./autobuild && ./configure && make all install && cd ..
175 173
176 -# Para compilação do Tesseract após a compilação do leptonica  
177 -export PKG_CONFIG_PATH=/usr/lib:/usr/local/lib:/usr/local/src/leptonica/ 174 + # Para compilação do Tesseract após a compilação do leptonica
  175 + export PKG_CONFIG_PATH=/usr/lib:/usr/local/lib:/usr/local/src/leptonica/
178 176
179 -cd libav && ./configure --enable-sram && make all install && cd .. 177 + cd libav && ./configure --enable-sram && make all install && cd ..
180 178
181 -# Tesseract  
182 -cd tesseract && ./autogen.sh && ./configure && make all install && cd ..  
183 -cp -avR tessdata/* /usr/local/share/tessdata/ 179 + # Tesseract
  180 + cd tesseract && ./autogen.sh && ./configure && make all install && cd ..
  181 + cp -avR tessdata/* /usr/local/share/tessdata/
184 182
185 -# cpdf, versão 2.1 ou superior  
186 -cd ocaml && ./configure && make world.opt && make install && cd ..  
187 -mkdir -p /usr/local/man/man5  
188 -# lib-findlib -- pode dar erro na instalação de páginas de man... é seguro ignorar, ou basta criar os diretórios faltantes e tentar novamente  
189 -cd lib-findlib && ./configure && make all && make install && cd ..  
190 -cd camlpdf && sed -i.bak s/\(uint32\)/\(uint32_t\)/g flatestubs.c && make && make install && cd ..  
191 -cd cpdf-source && make all && make install && cp cpdf /usr/local/bin && cd .. 183 + # cpdf, versão 2.1 ou superior
  184 + cd ocaml && ./configure && make world.opt && make install && cd ..
  185 + mkdir -p /usr/local/man/man5
  186 + # lib-findlib -- pode dar erro na instalação de páginas de man... é seguro ignorar, ou basta criar os diretórios faltantes e tentar novamente
  187 + cd lib-findlib && ./configure && make all && make install && cd ..
  188 + cd camlpdf && sed -i.bak s/\(uint32\)/\(uint32_t\)/g flatestubs.c && make && make install && cd ..
  189 + cd cpdf-source && make all && make install && cp cpdf /usr/local/bin && cd ..
192 190
193 -# poppler-utils, versão 0.42.0 ou superior  
194 -cd poppler && ./autogen.sh && ./configure --enable-cmyk --enable-libcurl && make all install && cd .. 191 + # poppler-utils, versão 0.42.0 ou superior
  192 + cd poppler && ./autogen.sh && ./configure --enable-cmyk --enable-libcurl && make all install && cd ..
195 193
196 -# Centos 6.9  
197 -# \_ Termina o shell usando o GCC 4.8 por default  
198 -exit 194 + # Centos 6.9
  195 + # \_ Termina o shell usando o GCC 4.8 por default
  196 + exit
199 197
200 -# ----------------------- INSTALAÇÃO (obs.: os comandos devem ser executados como root)  
201 198
202 ## Comandos adicionais para configuração do módulo: 199 ## Comandos adicionais para configuração do módulo:
203 200
204 -# Criação do usuário  
205 -adduser ocr  
206 -  
207 -# Copie os arquivos ocr ocr-* para os diretórios corretos, conforme o sistema operacional  
208 -cp ./usr/local/bin/ocr /usr/local/bin  
209 -  
210 -# Auto start (RedHat 6.7 e CentOs 6.9)  
211 -cp ./usr/local/etc/init.d/ocr-redhat /etc/init.d/ocr  
212 -mv /etc  
213 -chkconfig --add ocr  
214 -chkconfig --level 2345 ocr on  
215 -  
216 -# Auto start (Ubuntu 14.04)  
217 -cp ./usr/local/etc/init.d/ocr-ubuntu /etc/init.d/ocr  
218 -update-rd.d ocr defaults  
219 -  
220 -# Create pkg -- para instalação em outras máquinas sem a necessidade de novas compilações  
221 -cd /home/ocr  
222 -tar cvozf pkg-ocr.tgz /usr/local/bin /usr/local/lib* /usr/local/man/ /usr/local/sbin/ /usr/local/share/ /usr/local/etc /usr/local/include/ /home/ocr/ocr* /etc/init.d/ocr /etc/rc*.d/*ocr  
223 -su  
224 -  
225 -# Copie o pacote para os outros servidores e extraia com:  
226 -cd /  
227 -tar xovzf pkg-ocr.tgz  
228 -  
229 -# Instalando pré-requisitos RUNTIME em servidores adicionais  
230 -  
231 -# Redhat 6.7 e CentOS 6.9  
232 -yum -y install perl-File-Find-Rule-Perl perl-File-Touch libtiff libpng openjpeg-libs libjpeg-turbo giflib zlib libicu pango cairo fontconfig ImageMagick gettext libwebp ghostscript  
233 -yum -y install libtiff libpng openjpeg libjpeg-turbo giflib libwebp zlib libicu pango cairo fontconfig gettext  
234 -  
235 -# Ubuntu 14.04  
236 -apt-get install libfile-find-rule-perl libfile-find-rule-perl-perl libtiff5 libpng12-0 libopenjpeg2 libjpeg-turbo8 libgif4 zlib1g libicu52 libpango1.0-0 libcairo2 fontconfig imagemagick gettext libwebp5 # libgcj14  
237 -apt-get install libtiff5 libpng12-0 libopenjpeg2 libjpeg8 libjpeg-turbo8 libjpeg8 zlib1g libpango1.0-0 libcairo2 libfontconfig1 libgettextpo0 ghostscript 201 + # Criação do usuário
  202 + adduser ocr
  203 +
  204 + # Copie os arquivos ocr ocr-* para os diretórios corretos, conforme o sistema operacional
  205 + cp ./usr/local/bin/ocr /usr/local/bin
  206 +
  207 + # Auto start (RedHat 6.7 e CentOs 6.9)
  208 + cp ./usr/local/etc/init.d/ocr-redhat /etc/init.d/ocr
  209 + mv /etc
  210 + chkconfig --add ocr
  211 + chkconfig --level 2345 ocr on
  212 +
  213 + # Auto start (Ubuntu 14.04)
  214 + cp ./usr/local/etc/init.d/ocr-ubuntu /etc/init.d/ocr
  215 + update-rd.d ocr defaults
  216 +
  217 + # Create pkg -- para instalação em outras máquinas sem a necessidade de novas compilações
  218 + cd /home/ocr
  219 + tar cvozf pkg-ocr.tgz /usr/local/bin /usr/local/lib* /usr/local/man/ /usr/local/sbin/ /usr/local/share/ /usr/local/etc /usr/local/include/ /home/ocr/ocr* /etc/init.d/ocr /etc/rc*.d/*ocr
  220 + su
  221 +
  222 +# INSTALAÇÃO (obs.: os comandos devem ser executados como root)
  223 + # Criação do usuário
  224 + adduser ocr
  225 +
  226 + # Copie o pacote para os outros servidores e extraia com:
  227 + cd /
  228 + tar xovzf pkg-ocr.tgz
  229 +
  230 + # Instalando pré-requisitos RUNTIME em servidores adicionais
  231 +
  232 + # Redhat 6.7 e CentOS 6.9
  233 + yum -y install perl-File-Find-Rule-Perl perl-File-Touch libtiff libpng openjpeg-libs libjpeg-turbo giflib zlib libicu pango cairo fontconfig ImageMagick gettext libwebp ghostscript
  234 + yum -y install libtiff libpng openjpeg libjpeg-turbo giflib libwebp zlib libicu pango cairo fontconfig gettext
  235 +
  236 + # Ubuntu 14.04
  237 + apt-get install libfile-find-rule-perl libfile-find-rule-perl-perl libtiff5 libpng12-0 libopenjpeg2 libjpeg-turbo8 libgif4 zlib1g libicu52 libpango1.0-0 libcairo2 fontconfig imagemagick gettext libwebp5 # libgcj14
  238 + apt-get install libtiff5 libpng12-0 libopenjpeg2 libjpeg8 libjpeg-turbo8 libjpeg8 zlib1g libpango1.0-0 libcairo2 libfontconfig1 libgettextpo0 ghostscript
238 239
239 # Inicie o serviço com 240 # Inicie o serviço com
240 -service ocr start 241 + service ocr start