次為大家介紹了如果用 Python 抓取公號文章并保存成 PDF 文件存儲到本地。但用這種方式下載的 PDF 只有文字沒有圖片,所以只適用于沒有圖片或圖片不重要的公眾號,那如果我想要圖片和文字下載下來怎么辦?今天就給大家介紹另一種方案——HTML。
其實我們要解決的有兩個問題:
綜上問題,我覺得還是把公眾號下載成網頁 HTML 格式最好看,下面就介紹下如何實現。
獲取文章鏈接的方式,和上一篇下載成 PDF 的文章一樣,依然是通過公眾號平臺的圖文素材里超鏈接查詢實現,在這里我們直接拿來上一期的代碼,進行修改即可。首先將原來文件 gzh_download.py 復制成 gzh_download_html.py,然后在此基礎進行代碼改造:
# gzh_download_html.py
# 引入模塊
import requests
import json
import re
import time
from bs4 import BeautifulSoup
import os
# 打開 cookie.txt
with open("cookie.txt", "r") as file:
cookie = file.read()
cookies = json.loads(cookie)
url = "https://mp.weixin.qq.com"
#請求公號平臺
response = requests.get(url, cookies=cookies)
# 從url中獲取token
token = re.findall(r'token=(\d+)', str(response.url))[0]
# 設置請求訪問頭信息
headers = {
"Referer": "https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit_v2&action=edit&isNew=1&type=10&token=" + token + "&lang=zh_CN",
"Host": "mp.weixin.qq.com",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36",
}
# 循環遍歷前10頁的文章
for j in range(1, 10, 1):
begin = (j-1)*5
# 請求當前頁獲取文章列表
requestUrl = "https://mp.weixin.qq.com/cgi-bin/appmsg?action=list_ex&begin="+str(begin)+"&count=5&fakeid=MzU1NDk2MzQyNg==&type=9&query=&token=" + token + "&lang=zh_CN&f=json&ajax=1"
search_response = requests.get(requestUrl, cookies=cookies, headers=headers)
# 獲取到返回列表 Json 信息
re_text = search_response.json()
list = re_text.get("app_msg_list")
# 遍歷當前頁的文章列表
for i in list:
# 目錄名為標題名,目錄下存放 html 和圖片
dir_name = i["title"].replace(' ','')
print("正在下載文章:" + dir_name)
# 請求文章的 url ,獲取文章內容
response = requests.get(i["link"], cookies=cookies, headers=headers)
# 保存文章到本地
save(response, dir_name, i["aid"])
print(dir_name + "下載完成!")
# 過快請求可能會被微信問候,這里進行10秒等待
time.sleep(10)
好了,從上面代碼可以看出,主要就是將原來的方法 pdfkit.from_url(i["link"], i["title"] + ".pdf") 改成了現在的方式,需要用 requests 請求下文章的 URL ,然后再調用保存文章頁面和圖片到本地的方法,這里的 save() 方法通過以下代碼實現。
#保存下載的 html 頁面和圖片
def save(search_response,html_dir,file_name):
# 保存 html 的位置
htmlDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), html_dir)
# 保存圖片的位置
targetDir = os.path.join(os.path.dirname(os.path.abspath(__file__)),html_dir + '/images')
# 不存在創建文件夾
if not os.path.isdir(targetDir):
os.makedirs(targetDir)
domain = 'https://mp.weixin.qq.com/s'
# 調用保存 html 方法
save_html(search_response, htmlDir, file_name)
# 調用保存圖片方法
save_file_to_local(htmlDir, targetDir, search_response, domain)
# 保存圖片到本地
def save_file_to_local(htmlDir,targetDir,search_response,domain):
# 使用lxml解析請求返回的頁面
obj = BeautifulSoup(save_html(search_response,htmlDir,file_name).content, 'lxml')
# 找到有 img 標簽的內容
imgs = obj.find_all('img')
# 將頁面上圖片的鏈接加入list
urls = []
for img in imgs:
if 'data-src' in str(img):
urls.append(img['data-src'])
elif 'src=""' in str(img):
pass
elif "src" not in str(img):
pass
else:
urls.append(img['src'])
# 遍歷所有圖片鏈接,將圖片保存到本地指定文件夾,圖片名字用0,1,2...
i = 0
for each_url in urls:
# 跟據文章的圖片格式進行處理
if each_url.startswith('//'):
new_url = 'https:' + each_url
r_pic = requests.get(new_url)
elif each_url.startswith('/') and each_url.endswith('gif'):
new_url = domain + each_url
r_pic = requests.get(new_url)
elif each_url.endswith('png') or each_url.endswith('jpg') or each_url.endswith('gif') or each_url.endswith('jpeg'):
r_pic = requests.get(each_url)
# 創建指定目錄
t = os.path.join(targetDir, str(i) + '.jpeg')
print('該文章共需處理' + str(len(urls)) + '張圖片,正在處理第' + str(i + 1) + '張……')
# 指定絕對路徑
fw = open(t, 'wb')
# 保存圖片到本地指定目錄
fw.write(r_pic.content)
i += 1
# 將舊的鏈接或相對鏈接修改為直接訪問本地圖片
update_file(each_url, t, htmlDir)
fw.close()
# 保存 HTML 到本地
def save_html(url_content,htmlDir,file_name):
f = open(htmlDir+"/"+file_name+'.html', 'wb')
# 寫入文件
f.write(url_content.content)
f.close()
return url_content
# 修改 HTML 文件,將圖片的路徑改為本地的路徑
def update_file(old, new,htmlDir):
# 打開兩個文件,原始文件用來讀,另一個文件將修改的內容寫入
with open(htmlDir+"/"+file_name+'.html', encoding='utf-8') as f, open(htmlDir+"/"+file_name+'_bak.html', 'w', encoding='utf-8') as fw:
# 遍歷每行,用replace()方法替換路徑
for line in f:
new_line = line.replace(old, new)
new_line = new_line.replace("data-src", "src")
# 寫入新文件
fw.write(new_line)
# 執行完,刪除原始文件
os.remove(htmlDir+"/"+file_name+'.html')
time.sleep(5)
# 修改新文件名為 html
os.rename(htmlDir+"/"+file_name+'_bak.html', htmlDir+"/"+file_name+'.html')
好了,上面就是將文章頁面和圖片下載到本地的代碼,接下來我們運行命令 python gzh_download_html.py ,程序開始執行,打印日志如下:
$ python gzh_download_html.py
正在下載文章:學習Python看這一篇就夠了!
該文章共需處理3張圖片,正在處理第1張……
該文章共需處理3張圖片,正在處理第2張……
該文章共需處理3張圖片,正在處理第3張……
學習Python看這一篇就夠了!下載完成!
正在下載文章:PythonFlask數據可視化
該文章共需處理2張圖片,正在處理第1張……
該文章共需處理2張圖片,正在處理第2張……
PythonFlask數據可視化下載完成!
正在下載文章:教你用Python下載手機小視頻
該文章共需處理11張圖片,正在處理第1張……
該文章共需處理11張圖片,正在處理第2張……
該文章共需處理11張圖片,正在處理第3張……
該文章共需處理11張圖片,正在處理第4張……
該文章共需處理11張圖片,正在處理第5張……
該文章共需處理11張圖片,正在處理第6張……
該文章共需處理11張圖片,正在處理第7張……
現在我們去程序存放的目錄,就能看到以下都是以文章名稱命名的文件夾:
進入相應文章目錄,可以看到一個 html 文件和一個名為 images 的圖片目錄,我們雙擊打開擴展名為 html 的文件,就能看到帶圖片和代碼框的文章,和在公眾號看到的一樣。
本文為大家介紹了如何通過 Python 將公號文章批量下載到本地,并保存為 HTML 和圖片,這樣就能實現文章的離線瀏覽了。當然如果你想將 HTML 轉成 PDF 也很簡單,直接用 pdfkit.from_file(xx.html,target.pdf) 方法直接將網頁轉成 PDF,而且這樣轉成的 PDF 也是帶圖片的。
1.zabbix-2.4.8.tar.gz zabbix-3.0.31.tar.gz
下載地址:https://www.zabbix.com/download
2.php5.4.16.tar.gz
下載地址:https://www.php.net/downloads.php
安裝過程路徑、密碼盡量不要出現中文、特殊字符、空格、少于8位密碼。
注意不可以跨版本升級
IP 主機名 用途
10.10.10.181 zabbixserver 監控服務器
應用名稱
路徑
Apache配置文件:/etc/httpd/conf/httpd.conf
Apache發布路徑:/var/www/html
Zabbix安裝路徑:/usr/local/zabbix
Zabbix配置文件:/usr/local/zabbix/etc/zabbix_server.conf
Php配置文件:/etc/php.ini
Mysql安裝路徑:/var/lib/mysql/
? 根據上表端口規劃情況,在不同服務器操作開放相應端口
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=80/tcp
? 重啟防火墻
# firewall-cmd --reload
# sed -i "s@SELINUX=enforcing@SELINUX=disabled@g" /etc/selinux/config
# cat /etc/selinux/config | grep SELINUX=
# setenforce 0
1、Mysql備份
# /etc/init.d/zabbix_server stop
# /etc/init.d/zabbix_agentd stop
# mkdir /opt/bak && cd /opt/bak
# mysqldump -uroot -p zabbix > /opt/bak/zabbix.sql
2、zabbix配置備份
# cp /usr/local/zabbix/etc/zabbix_server.conf /opt/bak
# cp /etc/php.ini /opt/bak
# cp /etc/httpd/conf/httpd.conf /opt/bak
# cp -R /var/www/html/* /opt/bak/html/
# yum install httpd php php-gd gcc php-mysql php-xml libcurl-devel curl-* net-snmp* libxml2-* bcmath mbstring php-devel lrzsz wget vim zip unzip net-tools ntpdate ntp php-bcmath php-mbstring-y
# useradd zabbix -s /sbin/nologin -M
參照我的頭條文章:CentOS7.x生產環境MySQL社區版yum方式部署
SQL> create database zabbix;
SQL> grant all on zabbix.* to zabbix@localhost identified by 'zabbixpwd123';
SQL> flush privileges;
# mysql -uroot -p zabbix < /opt/bak/zabbix.sql
# vi /etc/sysctl.conf
kernel.shmmax = 34359738368
kernel.shmmni = 4096
kernel.shmall = 8388608
kernel.sem = 1010 129280 1010 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
fs.file-max = 6815744
# /sbin/sysctl -p
# vi /etc/security/limits.conf
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
* soft stack 10240
1、下載路徑:
# cd /opt/ && wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.8/zabbix-2.4.8.tar.gz/download?use_mirror=nchc&download=
2、上傳zabbix-2.4.8.tar.gz到服務器/opt目錄下面
# tar -zxvf zabbix-2.4.8.tar.gz
3、進行編譯安裝zabbix_server
# find / -name mysql_config
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/var/lib/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2
# make && make install
# cd /opt/zabbix-2.4.8/misc/init.d/fedora/core
# cp zabbix_server /etc/init.d/
# cp zabbix_agentd /etc/rc.d/init.d/
# chmod +x /etc/rc.d/init.d/zabbix_*
# vim /etc/rc.d/init.d/zabbix_server
BASEDIR=/usr/local/zabbix
# vim /etc/rc.d/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix
# chkconfig zabbix_server on
# chkconfig --add zabbix_server
# chkconfig zabbix_agentd on
# chkconfig --add zabbix_agentd
# cp /opt/bak/zabbix_server.conf /usr/local/zabbix/etc
# cd /opt/ && wget http://www.fping.org/dist/fping-4.2.tar.gz
# tar -zxvf fping-4.2.tar.gz && cd fping-4.2/
# ./configure && make && make install
# which fping
/usr/local/sbin/fping
# find / -name mysql.sock
# mkdir /usr/lib/zabbix/alertscripts -p
# chown -R zabbix:zabbix /usr/lib/zabbix
# egrep -v "^#|^$" /usr/local/zabbix/etc/zabbix_server.conf
#備注:如果數據庫與zabbix_server是異機時參數DBHost的配置要修改為對應數據庫IP,并注釋DBSocket配置;如果機器是相同時要核對DBSocket的具體路徑。
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=密碼
DBSocket=/var/lib/mysql/mysql.sock
StartPollers=20
AlertScriptsPath=/usr/lib/zabbix/alertscripts
FpingLocation=/usr/local/sbin/fping
# cd /var/www/html/
# cp -R /opt/zabbix-2.4.8/frontends/php/* .
# chown -R apache:apache *
# cp /opt/bak/php.ini /etc/
# vim /etc/httpd/conf/httpd.conf
#將如下代碼段
#ServerName www.example.com:80
---修改為
ServerName localhost:80
#模塊中注意添加php對應版本的支持
DirectoryIndex index.html index.php
AddType application/x-httpd-php .php .php3 .php4 .php5
# systemctl restart httpd
1、 在瀏覽器中打開訪問地址:http://10.10.10.181/setup.php
2、檢查系統環境,必須全部ok才能繼續
安裝時檢查系統環境時的錯誤提示:出現bcmath與mbstring顯示為fail
解決方法:安裝對應php版本的依賴庫
# rpm –qa | grep php-devel
# yum -y install php-devel
# cd /opt && tar -zxf php-5.4.16.tar.gz
# cd php-5.4.16/ext/bcmath/
# which phpize
/usr/bin/phpize
# find / -name php-config
/usr/bin/php-config
# /usr/bin/phpize
# ./configure --with-php-config=/usr/bin/php-config
# make && make install
# ll /usr/lib64/php/modules/
# ll /opt/php-5.4.16/ext/bcmath/modules
# cd ../mbstring/
# /usr/bin/phpize
# ./configure --with-php-config=/usr/bin/php-config
# make && make install
# systemctl restart httpd
如果還是出現fail則直接指定庫位置,再重啟httpd服務
# vim /etc/php.ini
extension=/usr/lib64/php/modules/bcmath.so
extension=/usr/lib64/php/modules/mbstring.so
3、配置mysql數據連接
Test connection #顯示ok表示通過
如下圖所示的錯誤時,原因是zabbix_server默認會去讀取/var/lib/mysql/下的mysql.sock 解決辦法是創建該路徑,并創建軟連接,操作指令如下
# mkdir /var/lib/mysql
# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
# chown -R mysql:mysql /var/lib/mysql
# vi /etc/php.ini
mysql.default_socket = /var/lib/mysql/mysql.sock
# systemctl restart httpd
同時將Database host修改為127.0.0.1
4、5直接點擊Next
6點擊Finish(如果提示無法創建,需要手工下載提示的zabbix.conf.php ,并將其上傳到服務器/var/www/html/conf/路徑下)
最后的登錄用戶/密碼:admin/zabbix
1、解決中文問題
到server的web界面。點擊右上角profile,看是否在語言項是否有中文,要是有,直接勾選保存,web界面就可以顯示中文,要是沒有中文選項,那么進行一下配置。
# vim /var/www/html/include/locales.inc.php
zh_CN' => array('name' => _('Chinese (zh_CN)'), 'display' => false),
---修改為
'zh_CN' => array('name' => _('Chinese (zh_CN)'), 'display' => true),
重啟zabbix_server服務:
# service zabbix_server restart
# service zabbix_agentd restart
2、中文亂碼問題,在圖形等界面部分字體存在亂碼問題
將本機C:\Windows\Fonts\simkai.ttf上傳到服務器/var/www/html/fonts/
# vim /var/www/html/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans');
---修改為
define('ZBX_GRAPH_FONT_NAME', 'simkai');
重啟zabbix_server服務:
# service zabbix_server restart
# mkdir /opt/bak24/html -p
# service zabbix_agentd stop
# service zabbix_server stop
# mysqldump -uroot -p zabbix > /opt/bak24/zabbix.sql
# cp -r /usr/local/zabbix /opt/bak24
# cp /etc/php.ini /opt/bak24
# cp /etc/httpd/conf/httpd.conf /opt/bak24
# mv /var/www/html/* /opt/bak24/html/
# mv /etc/init.d/zabbix_agentd /opt/bak24
# mv /etc/init.d/zabbix_server /opt/bak24
1、下載路徑:
# cd /opt/
# wget https://cdn.zabbix.com/zabbix/sources/stable/3.0/zabbix-3.0.31.tar.gz
2、上傳zabbix-3.0.31.tar.gz到服務器/opt目錄下面
# tar -zxvf zabbix-3.0.31.tar.gz
3、進行編譯安裝zabbix_server
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/var/lib/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2
# make && make install
# cd /opt/zabbix-3.0.31/misc/init.d/fedora/core
# cp zabbix_* /etc/init.d/
# chmod +x /etc/rc.d/init.d/zabbix_*
# vim /etc/rc.d/init.d/zabbix_server
BASEDIR=/usr/local/zabbix
# vim /etc/rc.d/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix
# chkconfig zabbix_server on
# chkconfig --add zabbix_server
# chkconfig zabbix_agentd on
# chkconfig --add zabbix_agentd
# cp /usr/local/zabbix/etc/zabbix_server.conf /opt/bak24/zabbix_server3.conf
# cp /opt/bak24/zabbix/etc/zabbix_server.conf /usr/local/zabbix/etc
# egrep -v "^#|^$" /usr/local/zabbix/etc/zabbix_server.conf
#備注:如果數據庫與zabbix_server是異機時參數DBHost的配置要修改為對應數據庫IP,并注釋DBSocket配置;如果機器是相同時要核對DBSocket的具體路徑。
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=密碼
DBSocket=/var/lib/mysql/mysql.sock
StartPollers=20
AlertScriptsPath=/usr/lib/zabbix/alertscripts
FpingLocation=/usr/local/sbin/fping
# cd /var/www/html/
# cp -R /opt/zabbix-3.0.31/frontends/php/* .
# cp /opt/bak24/httpd.conf /etc/httpd/conf
# chown -R apache:apache *
# cp /opt/bak24/php.ini /etc/
# vim /etc/httpd/httpd.conf --核對配置信息
#將如下代碼段
#ServerName www.example.com:80
---修改為
ServerName localhost:80
#模塊中注意添加php對應版本的支持
DirectoryIndex index.html index.php
AddType application/x-httpd-php .php .php3 .php4 .php5
# systemctl restart httpd
1、 在瀏覽器中打開訪問地址:http://10.10.10.181/setup.php
2、檢查系統環境,必須全部ok才能繼續
安裝或升級時檢查系統環境時的錯誤提示:ldap 顯示Warning
解決方法:安裝對應php版本的依賴庫
# cd /opt && tar -zxf php-5.4.16.tar.gz
# cd php-5.4.16/ext/ldap
# /usr/bin/phpize
# ./configure --with-php-config=/usr/bin/php-config && make && make install
安裝ldap報錯一:configure: error: Cannot find ldap.h
解決辦法:
# yum -y install openldap openldap-devel
安裝ldap報錯二:configure: error: Cannot find ldap libraries in /usr/lib
解決辦法:
# cp -frp /usr/lib64/libldap* /usr/lib/
# /usr/bin/phpize
# make clean && ./configure --with-php-config=/usr/bin/php-config && make && make install
# systemctl restart httpd
如果還是出現Warning則直接指定庫位置,再重啟httpd服務
# vim /etc/php.ini
extension=/usr/lib64/php/modules/ldap.so
3、配置mysql數據連接
Test connection #顯示ok表示通過
升級連接數據庫時的錯誤提示:Cannot connect to the database.
The frontend does not match Zabbix database. Current database version (mandatory/optional): 2040000/2040000.
Required mandatory version: 3000000. Contact your system administrator.
原因:新的Zabbix所需數據庫版本與現數據庫版本不一致導致,更改版本號即可
解決辦法:
# mysql -uroot -p
SQL> use zabbix;
SQL> update dbversion set mandatory=3000000;
SQL> flush privileges;
4、5直接點擊Next
6點擊Finish
最后的登錄用戶/密碼:admin/zabbix
界面亂碼問題處理:
# service zabbix_server start
# tail -100f /var/log/messages
zabbix_server: Starting zabbix_server:
/usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
# find / -name 'libmysqlclient*'
/usr/lib64/mysql/libmysqlclient.so.18
/usr/lib64/mysql/libmysqlclient.so.18.0.0
/mysql/mysql/lib/libmysqlclient.a
/mysql/mysql/lib/libmysqlclient.so
/mysql/mysql/lib/libmysqlclient.so.20
/mysql/mysql/lib/libmysqlclient.so.20.3.15
# ln -s /mysql/mysql/lib/libmysqlclient.so.20 /usr/lib64
# tail -100f /tmp/zabbix_server.log ---查看zabbix_server日志,排查升級問題
…………………
17120:20200610:181128.506 completed 98% of database upgrade
17120:20200610:181128.507 completed 99% of database upgrade
17120:20200610:181128.507 completed 100% of database upgrade
17120:20200610:181128.507 database upgrade fully completed
17120:20200610:181128.566 server #0 started [main process]
17128:20200610:181128.566 server #1 started [configuration syncer #1]
17129:20200610:181128.567 server #2 started [db watchdog #1]
17130:20200610:181128.567 server #3 started [poller #1]
…………………
★★建議星標我們★★★
Java進階架構師★“星標”!這樣才不會錯過每日進階架構文章呀。
2020年Java原創面試題庫連載中
【000期】Java最全面試題庫思維導圖
【020期】JavaSE系列面試題匯總(共18篇)
【028期】JavaWeb系列面試題匯總(共10篇)
【042期】JavaEE系列面試題匯總(共13篇)
【049期】數據庫系列面試題匯總(共6篇)
【053期】中間件系列面試題匯總(共3篇)
【065期】數據結構與算法面試題匯總(共11篇)
【076期】分布式面試題匯總(共10篇)
【077期】綜合面試題系列(一)
【078期】綜合面試題系列(二)
【079期】綜合面試題系列(三)
【080期】綜合面試題系列(四)
【081期】綜合面試題系列(五)
【082期】綜合面試題系列(六)
【083期】綜合面試題系列(七)
【084期】綜合面試題系列(八)
【085期】綜合面試題系列(九)
【086期】綜合面試題系列(十)
【087期】綜合面試題系列(十一)
【088期】綜合面試題系列(十二)
【089期】綜合面試題系列(十三)
更多內容,點擊上面藍字查看
本項目是通過學習https://gitee.com/nbsl/idCardCv 后整合tess4j,不需要經過訓練直接使用的,當然,你也可以進行訓練后進行使用。該項目修改原有的需要安裝opencv的過程,全部使用javaccp技術重構,通過javaccp引入需要的c++庫進行開發。不需要安裝opencv 新增的了前端控制識別區域的功能,新增了后端識別后驗證 ,頁面樣式主要適應paid,重新修改了后面的識別過程,用戶opencv進行圖片優化和區域 選擇,使用tess4j進行數字和x的識別 配合樣式中的區域在后臺裁剪相關區域圖片 /idCardCv/src/main/resources/static/js/plugins/cropper/cropper.css
1、java.lang.UnsatisfiedLinkError: C:\Users\Administrator.javacpp\cache\opencv-3.4.3-1.4.3-windows-x86_64.jar\org\bytedeco\javacpp\windows-x86_64\jniopencv_core.dll: Can't find dependent libraries 我的問題是因為沒有c++運行環境,我在img/vc_redist.x64.exe中添加了64位的運行環境
請求地址 http://localhost:8080/idCard/index 它基于openCV這個開源庫。這意味著你可以獲取全部源代碼,并且移植到opencv支持的所有平臺。它是基于java開發。它的識別率較高。圖片清晰情況下,號碼檢測與識別準確率在90%以上。
本版本在以下平臺測試通過:
windows7 64bit
jdk1.8.0_45
junit 4
opencv4.3
javaccp1.5.3
tess4j4.5.1
tesseract4.0.0
1、先前使用base64進行圖片的上傳比較緩慢,使用webuploader插件進行分片上傳,網速慢的時候可以提升速度,尤其是paid瀏覽器使用。原頁面改為idcard_bak.html。
2、原項目中有測試圖片保存路徑,統一更新到配置文檔中。
3、將opencv3.4.3升級到4.3
https://gitee.com/endlesshh/idCardCv
PS:如果覺得我的分享不錯,歡迎大家隨手點贊、在看。
之前,給大家發過三份Java面試寶典,這次新增了一份,目前總共是四份面試寶典,相信在跳槽前一個月按照面試寶典準備準備,基本沒大問題。
《java面試寶典5.0》(初中級)
《350道Java面試題:整理自100+公司》(中高級)
《資深java面試寶典-視頻版》(資深)
《Java[BAT]面試必備》(資深)
分別適用于初中級,中高級,資深級工程師的面試復習。
內容包含java基礎、javaweb、mysql性能優化、JVM、鎖、百萬并發、消息隊列,高性能緩存、反射、Spring全家桶原理、微服務、Zookeeper、數據結構、限流熔斷降級等等。
看到這里,證明有所收獲
*請認真填寫需求信息,我們會在24小時內與您取得聯系。