国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Perl > 正文

Perl使用Tesseract-OCR實現驗證碼識別教程

2020-06-04 20:31:53
字體:
來源:轉載
供稿:網友

一、Tesseract-OCR 是什么

An OCR Engine that was developed at HP Labs between 1985 and 1995… and now at Google
基于Leptonica(http://leptonica.com/)圖形處理庫開的開源圖形識別引擎。
支持Linux、Windows、Mac平臺,
支持.NET、C++、Python、Java等開發語言:https://code.google.com/p/tesseract-ocr/wiki/AddOns
項目地址:https://code.google.com/p/tesseract-ocr/

二、使用方法

下載安裝:https://tesseract-ocr.googlecode.com/files/tesseract-ocr-setup-3.02.02.exe
注意安裝時的Path目錄、數學符號、語言選項,按需選擇。
執行:”tesseract yourpic.png res”
圖片 yourpic.png 里面的內容會被識別后保存在 res.txt
為了更精確的識別可以去到項目地址上下載相應的各種語言的 language tessdata
例如:
簡體中文 https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.chi_sim.tar.gz
繁體中文
下載解壓后 chi_sim.traineddata 復制到 Tesseract-OCR/tessdata 即可
執行:
“tesseract yourpic.png eng” 使用 默認eng語言包
“tesseract yourpic.png sim -l chi_sim” 使用 chi_sim語言包
“tesseract yourpic.png tra -l chi_tra” 使用 chi_sim語言包
選擇最接近真實數據的,方便以后修正

三、進階使用 Training

為數不多的training tesseract-ocr中文文檔
http://yy-programer.blogspot.tw/2012/08/training-tesseract-ocr-301.html
對于高精度需求的需要研究一下了,日常民用級別,默認識別加后期修正即可。

四、應用實例之吸附代理

針對 http://www.proxyfire.net/ 幾個代理列表頁的代理吸附

話不多說直接上代碼,
pf.bat
代碼如下:
pf.pl http://www.proxyfire.net/index.php?pageid=eliteproxylist       elite.txt
pf.pl http://www.proxyfire.net/index.php?pageid=anonymousproxylist   anony.txt
pf.pl http://www.proxyfire.net/index.php?pageid=transparentproxylist trans.txt
pf.pl http://www.proxyfire.net/index.php?pageid=socks4proxylist      s4.txt
pf.pl http://www.proxyfire.net/index.php?pageid=socks5proxylist      s5.txt
type *.txt > all.tmp
del *.txt /s/q
ren all.tmp all.txt
@pause
pf.pl
代碼如下:
use strict;
 
our $url    = $ARGV[0];
our $file   = $ARGV[1];
 
my $res = undef;
my @tmp = undef;
my @pxy = undef;
 
    `wget $url -q -O ___html`;
    open FH, "<___html";
    @tmp = ;
    close FH;
    $res = join('',@tmp);
    undef(@tmp);
    `del ___html /s /q`;
 
@tmp = ( $res =~ /<img alt="" src="([^" border="0">]+)><//td>(/d+)'http://www.proxyfire.net'.$tmp[$i], 'port'=>$tmp[$i+1]};

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 隆子县| 黑水县| 凌源市| 崇左市| 达州市| 吉安市| 白沙| 吴桥县| 江城| 越西县| 万载县| 大理市| 闵行区| 调兵山市| 西城区| 太仆寺旗| 静乐县| 温宿县| 洪湖市| 承德县| 简阳市| 华池县| 金门县| 高尔夫| 虹口区| 金溪县| 崇义县| 罗定市| 长宁县| 轮台县| 定兴县| 鄂伦春自治旗| 桃源县| 丰都县| 卫辉市| 乐清市| 彩票| 松潘县| 石棉县| 子洲县| 密云县|