{"id":2814,"date":"2018-05-25T21:38:38","date_gmt":"2018-05-25T13:38:38","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2814"},"modified":"2018-05-25T21:38:38","modified_gmt":"2018-05-25T13:38:38","slug":"tesseract-ocr-%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2814","title":{"rendered":"Tesseract OCR \u6559\u7a0b"},"content":{"rendered":"<p>\n\tTesseract \u6700\u8fd1\u88ab\u5f00\u6e90\u51fa\u6765\u4e86\uff0c\u6211\u53d1\u73b0\u5728 GitHub \u4e0a\u83b7\u5f97\u4e86\u5f88\u591a\u7684 star\u3002\u5b83\u662f\u4e00\u6b3e\u6709 C++ \u7f16\u5199\u7684\u5f00\u6e90\u56fe\u7247\u6587\u5b57 OCR \u8bc6\u522b\u8f6f\u4ef6\u5e93\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 C++ \u6765\u8c03\u7528\u5b83\uff0c\u4ece\u800c\u5b9e\u73b0\u56fe\u7247\u4e0a\u7684\u6587\u5b57\u8bc6\u522b\u3002\n<\/p>\n<p>\n\tTesseract \u88ab\u79f0\u4e3a&nbsp;OCR \u5f15\u64ce\u3002Tesseract \u8f6f\u4ef6\u5305\u63d0\u4f9b\u4e86\u4e00\u4e2a OCR \u5f15\u64ce\uff1alibtesseract \u548c\u4e00\u4e2a\u547d\u4ee4\u884c\u7a0b\u5e8f\uff1atesseract\u3002\u9996\u5e2d\u5f00\u53d1\u4eba\u5458\u662fRay Smith\u3002\u7ef4\u62a4\u8005\u662fZdenko Podobny\u3002\n<\/p>\n<p>\n\tTesseract \u652f\u6301Unicode\uff08UTF-8\uff09\uff0c\u53ef\u4ee5\u8bc6\u522b\u8d85\u8fc7100\u79cd\u8bed\u8a00\u7684 &ldquo;\u5f00\u7bb1\u5373\u7528&rdquo;\u3002\n<\/p>\n<p>\n\tTesseract \u652f\u6301\u5404\u79cd\u8f93\u51fa\u683c\u5f0f\uff1a\u7eaf\u6587\u672c\uff0chocr\uff08html\uff09\uff0cpdf\uff0ctsv\uff0c\u4e0d\u53ef\u89c1\u6587\u672cpdf\u3002\n<\/p>\n<p>\n\t\u5728\u56fe\u7247\u8bc6\u522b\u4e2d\uff0cTesseract \u7684\u8bc6\u522b\u7387\u8fd8\u53d6\u51b3\u4e8e\u4f60\u63d0\u4f9b\u7684\u56fe\u7247\u7684\u8d28\u91cf\uff0c\u8d28\u91cf\u8d8a\u9ad8\u8bc6\u522b\u7387\u8d8a\u9ad8\uff01\n<\/p>\n<p>\n\tTesseract \u53ef\u4ee5\u8bad\u7ec3\u8bc6\u522b\u5176\u4ed6\u8bed\u8a00\u3002\n<\/p>\n<h2>\n\tTesseract \u7b80\u4ecb<br \/>\n<\/h2>\n<p>\n\tTesseract \u6700\u521d\u662f\u57281985\u5e74\u81f31994\u5e74\u7684\u60e0\u666e\u5e03\u91cc\u65af\u6258\u5c14\u5b9e\u9a8c\u5ba4\u548c\u79d1\u7f57\u62c9\u591a\u5dde\u683c\u91cc\u5229\u7684\u60e0\u666e\u516c\u53f8\u5f00\u53d1\u7684\uff0c\u57281996\u5e74\u8fdb\u884c\u4e86\u4e00\u4e9b\u66f4\u6539\u4ee5\u4fbf\u79fb\u690d\u5230Windows\uff0c\u5e76\u57281998\u5e74\u8fdb\u884c\u4e86\u4e00\u4e9bC ++\u5316\u30022005\u5e74\uff0cTesseract\u5f00\u653e\u6765\u6e90\u4e8e\u60e0\u666e\u3002\u81ea2006\u5e74\u4ee5\u6765\uff0c\u5b83\u7531Google\u5f00\u53d1\u3002\n<\/p>\n<p>\n\t\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u662f3.05.01\uff0c\u4e8e2017\u5e746\u67081\u65e5\u53d1\u5e03\u3002\n<\/p>\n<h2>\n\t\u5b89\u88c5 Tesseract<br \/>\n<\/h2>\n<p>\n\t\u6211\u4eec\u62e5\u6709\u4e24\u79cd\u65b9\u5f0f\u6765\u5b89\u88c5\u5b83\u3002\u4e00\u79cd\u662f\u4f7f\u7528\u5b83\u7684\u4e8c\u8fdb\u5236\u5b89\u88c5\u5305\uff0c\u8fd8\u6709\u4e00\u79cd\u662f\u4ece GitHub \u4e0a\u4e0b\u8f7d\u5b83\u7684\u6e90\u7801\uff0c\u81ea\u5df1\u8fdb\u884c\u7f16\u8bd1\uff0c\u7136\u540e\u5b89\u88c5\u3002\n<\/p>\n<p>\n\t\u4e0d\u4f1a\u7684\u7f51\u53cb\uff0c\u53ef\u4ee5\u53c2\u8003\u8fd9\u7bc7\u6587\u7ae0\uff1a<a href=\"https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki\" name=\"tesseract-ocr\" target=\"_blank\" title=\"tesseract-ocr\">https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki<\/a>\u3002\n<\/p>\n<p>\n\t\u5728 Linux \u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u91c7\u7528 sudo \u547d\u4ee4\u6765\u8fdb\u884c\u5b89\u88c5\u3002\n<\/p>\n<pre class=\"brush:php;\">\r\nsudo apt install tesseract-ocr\r\nsudo apt install libtesseract-dev<\/pre>\n<p>\n\t\u6216\u8005\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528 yum \u547d\u4ee4\u6765\u8fdb\u884c\u5b89\u88c5\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nyum-config-manager --add-repo https:\/\/download.opensuse.org\/repositories\/home:\/Alexander_Pozdnyakov\/CentOS_7\/\r\nyum update\r\nyum install tesseract \r\nyum install tesseract-langpack-deu<\/pre>\n<p>\n\t\u5b83\u63d0\u4f9b\u7684\u8fd8\u6709 rpm \u5305\u3002\u53ef\u4ee5\u8bf4\u652f\u6301\u5404\u79cd\u8bed\u8a00\uff0c\u5404\u79cd\u7cfb\u7edf\u3002Linux\u3001MacOS\u3001Linux\u3001Android \u5b83\u90fd\u80fd\u5f88\u597d\u7684\u652f\u6301\u3002\n<\/p>\n<p>\n\t\u5728 Windows \u7cfb\u7edf\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u94fe\u63a5\u8fdb\u884c\u4e0b\u8f7d\u76f8\u5173\u7248\u672c\u7684<a href=\"https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki\/Downloads\" name=\"tesseract\" target=\"_blank\" title=\"tesseract\">\u5b89\u88c5\u5305<\/a>\u3002Windows \u4e0a\u76ee\u524d\u6709&nbsp;4.0.0 \u548c 3.5.1 \u4e24\u4e2a\u7248\u672c\u53ef\u9009\u3002\n<\/p>\n<p>\n\tTesseract&nbsp;<font><font>\u652f\u6301\u7684\u7f16\u8bd1\u5668\u662f\uff1a<\/font><\/font>\n<\/p>\n<ul>\n<li>\n\t\t<font><font>GCC 4.8\u53ca\u4ee5\u4e0a<\/font><\/font>\n\t<\/li>\n<li>\n\t\t<font><font>Clang 3.4\u53ca\u4ee5\u4e0a\u7248\u672c<\/font><\/font>\n\t<\/li>\n<li>\n\t\t<font><font>MSVC 2015,2017<\/font><\/font>\n\t<\/li>\n<\/ul>\n<p>\n\t<font><font>\u5176\u4ed6\u7f16\u8bd1\u5668\u53ef\u80fd\u4f1a\u5de5\u4f5c\uff0c\u4f46\u6ca1\u6709\u5b98\u65b9\u652f\u6301\u3002<\/font><\/font>\n<\/p>\n<h2>\n\t<font><font>\u8fd0\u884c Tesseract<\/font><\/font><br \/>\n<\/h2>\n<p>\n\t\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u7684\u5f62\u5f0f\u8fd0\u884c Tesseract\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\ntesseract imagename outputbase [-l lang] [--oem ocrenginemode] [--psm pagesegmode] [configfiles...]<\/pre>\n<p>\n\t\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528&nbsp;tesseract &#8211;help \u6216 man tesseract \u638c\u63e1\u5b83\u7684\u547d\u4ee4\u884c\u7684\u5177\u4f53\u7528\u6cd5\u3002\n<\/p>\n<p>\n\t\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u4f7f\u7528libtesseract C\u6216C ++ API\u6765\u6784\u5efa\u81ea\u5df1\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\n<\/p>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/groups.google.com\/d\/forum\/tesseract-ocr\" rel=\"nofollow\"><font><font>tesseract-ocr<\/font><\/font><\/a><font><font>&nbsp;&#8211; \u9002\u7528\u4e8etesseract\u7528\u6237\u3002<\/font><\/font>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/groups.google.com\/d\/forum\/tesseract-dev\" rel=\"nofollow\"><font><font>tesseract-dev<\/font><\/font><\/a><font><font>&nbsp;&#8211; \u9002\u7528\u4e8etesseract\u5f00\u53d1\u4eba\u5458\u3002<\/font><\/font>\n\t<\/li>\n<\/ul>\n<p>\n\t\u4e0b\u9762\u770b\u4e00\u4e2a C++ \u4f7f\u7528 Tesseract \u7684\u4f8b\u5b50\uff1a\n<\/p>\n<pre class=\"brush:cpp;\">\r\n#include &quot;gtest\/gtest.h&quot;\r\n\r\nTEST(TesseractTest, FirstDummyTestForTesseract) {\r\n    ASSERT_TRUE(1);\r\n}\r\n\r\nint main(int argc, char **argv) {\r\n  ::testing::InitGoogleTest(&amp;argc, argv);\r\n  return RUN_ALL_TESTS();\r\n}<\/pre>\n<p>\n\t\u6211\u4eec\u4e5f\u53ef\u4ee5\u5728 tesseract \u6587\u4ef6\u5939\u4e2d\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff0c\u6765\u8fdb\u884c\u4e00\u4e9b\u7b80\u5355\u7684\u6d4b\u8bd5\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nautoreconf -fiv\r\ngit submodule update --init\r\nexport TESSDATA_PREFIX=\/prefix\/to\/path\/to\/tessdata\r\nmake check<\/pre>\n<p>\n\t\u597d\u4e86\uff0c\u66f4\u591a\u7684\u8bed\u8a00\u8c03\u7528\u548c\u7528\u6cd5\uff0c\u8bf7\u53c2\u8003<a href=\"https:\/\/github.com\/tesseract-ocr\/tesseract\" name=\"tesseract\" target=\"_blank\" title=\"tesseract\">\u5b98\u65b9\u6587\u6863<\/a>\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2814\">Tesseract OCR \u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>Tesseract \u6700\u8fd1\u88ab\u5f00\u6e90\u51fa\u6765\u4e86\uff0c\u6211\u53d1\u73b0\u5728 GitHub \u4e0a\u83b7\u5f97\u4e86\u5f88\u591a\u7684 star\u3002\u5b83\u662f\u4e00\u6b3e\u6709 C++ \u7f16 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118],"tags":[1018,1477,1641,409,1019],"class_list":["post-2814","post","type-post","status-publish","format-standard","hentry","category-ndisdevelop","tag-ocr","tag-ocrad-js","tag-tesseract","tag-409","tag-1019"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2814"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2814\/revisions"}],"predecessor-version":[{"id":2815,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2814\/revisions\/2815"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}