电话咨询
19922193247
yum install -y gcc libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel
wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.25.tar.gz
tar -zxvf GraphicsMagick-1.3.25.tar.gz
cd GraphicsMagick-1.3.25
./configure
make && make install
gm version
输出一下信息说明安装成功
GraphicsMagick 1.3.21 2015-02-28 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2014 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Native Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP no
DPS no
FlashPix no
FreeType yes
Ghostscript (Library) no
JBIG no
JPEG-2000 no
JPEG yes
Little CMS no
Loadable Modules no
OpenMP yes (201107)
PNG yes
TIFF yes
TRIO no
UMEM no
WebP no
WMF no
X11 no
XML no
ZLIB yes
Host type: x86_64-unknown-linux-gnu
Configured using the command:
./configure
Final Build Parameters:
CC = gcc -std=gnu99
CFLAGS = -fopenmp -g -O2 -Wall -pthread
CPPFLAGS = -I/usr/include/freetype2
CXX = g++
CXXFLAGS = -pthread
LDFLAGS = -L/usr/lib
LIBS = -ltiff -lfreetype -ljpeg -lpng15 -lz -lm -lgomp -lpthread
yum install -y autoconf automake libtool libjpeg libpng libtiff zlib libjpeg-devel libpng-devel libtiff-devel zlib-devel
wget http://www.leptonica.org/source/leptonica-1.77.0.tar.gz
tar -zxvf leptonica-1.77.0.tar.gz
cd leptonica-1.77.0
./configure
make && make install
wget https://github.com/tesseract-ocr/tesseract/archive/4.0.0.tar.gz
tar -zxvf 4.0.0.tar.gz
./autogen.sh
./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/include
make && make install
error: Leptonica 1.74 or higher is required. Try to install libleptonica-dev package"
vi /etc/profile把下面配置添加到最后
export LD_LIBRARY_PATH=$LD_LIBRARY_PAYT:/usr/local/lib
export LIBLEPT_HEADERSDIR=/usr/local/include
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
再执行source /etc/profile命令,让配置立即生效
之后再
./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/include
make && make install
tesseract -v
tesseract 4.00.00alpha
leptonica-1.77.1
libgif 4.1.6(?) : libjpeg 8d (libjpeg-turbo 1.5.0) : libpng 1.6.20 : libtiff 4.0.6 : zlib 1.2.8 : libwebp 0.4.3 : libopenjp2 2.1.0
下载两个npm包
npm install gm
npm install node-tesr
gm(imgPath)
.threshold(62,true)
.write(imgPath, (err) => {
if(!err){
tesseract(imgPath,{ l: 'eng', oem: 3, psm: 3 }, function(err, data) {
// 此处获得识别内容
data = data.replace(/\s+/g,"");
console.log("识别到验证码:", data);
})
}
});
温馨提示:我们将在您提交信息后的30分钟内与您取得联系,请您保持电话通畅,谢谢!