{"id":1002814,"date":"2024-12-27T10:12:00","date_gmt":"2024-12-27T02:12:00","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1002814.html"},"modified":"2024-12-27T10:12:03","modified_gmt":"2024-12-27T02:12:03","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e9%93%be%e6%8e%a5tesseract","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1002814.html","title":{"rendered":"\u5982\u4f55\u7528Python\u94fe\u63a5tesseract"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25080420\/ca7ae05a-b507-44ed-bee7-04fbe0da065c.webp\" alt=\"\u5982\u4f55\u7528Python\u94fe\u63a5tesseract\" \/><\/p>\n<p><p> <strong>\u4f7f\u7528Python\u94fe\u63a5Tesseract\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a\u5b89\u88c5Tesseract\u3001\u5b89\u88c5Pytesseract\u5e93\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u7f16\u5199Python\u4ee3\u7801\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5982\u4f55\u8fdb\u884c\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5Tesseract\u662f\u94fe\u63a5Python\u7684\u524d\u63d0\u6761\u4ef6\u3002Tesseract\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5149\u5b66\u5b57\u7b26\u8bc6\u522b\uff08OCR\uff09\u5f15\u64ce\uff0c\u53ef\u4ee5\u5728\u591a\u4e2a\u5e73\u53f0\u4e0a\u4f7f\u7528\u3002\u5728\u5b89\u88c5Tesseract\u4e4b\u540e\uff0c\u9700\u8981\u5b89\u88c5Pytesseract\u5e93\uff0c\u8fd9\u662fPython\u4e0eTesseract\u4e4b\u95f4\u7684\u6865\u6881\u3002\u63a5\u4e0b\u6765\uff0c\u9700\u8981\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u4ee5\u4fbfPython\u80fd\u591f\u627e\u5230Tesseract\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u6700\u540e\uff0c\u7f16\u5199Python\u4ee3\u7801\u4ee5\u4f7f\u7528Tesseract\u8fdb\u884cOCR\u64cd\u4f5c\u3002\u63a5\u4e0b\u6765\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e2a\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5b89\u88c5Tesseract<\/p>\n<\/p>\n<p><p>\u5b89\u88c5Tesseract\u662f\u5b9e\u73b0OCR\u529f\u80fd\u7684\u7b2c\u4e00\u6b65\u3002\u53ef\u4ee5\u6839\u636e\u64cd\u4f5c\u7cfb\u7edf\u7684\u4e0d\u540c\u9009\u62e9\u9002\u5408\u7684\u5b89\u88c5\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Windows<\/strong><br \/>\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u4eceTesseract\u7684<a href=\"https:\/\/github.com\/UB-Mannheim\/tesseract\/wiki\">GitHub<\/a>\u9875\u9762\u4e0b\u8f7d\u6700\u65b0\u7684\u5b89\u88c5\u5305\u3002\u4e0b\u8f7d\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u5305\uff0c\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u5c06Tesseract\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u4ee5\u4fbf\u5176\u4ed6\u7a0b\u5e8f\u80fd\u591f\u627e\u5230\u5b83\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>macOS<\/strong><br \/>\u5728macOS\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528Homebrew\u8fdb\u884c\u5b89\u88c5\u3002Homebrew\u662f\u4e00\u6b3e\u65b9\u4fbf\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u8f7b\u677e\u5b89\u88c5\u5404\u79cd\u8f6f\u4ef6\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Tesseract\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew install tesseract<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>Linux<\/strong><br \/>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\u8fdb\u884c\u5b89\u88c5\u3002\u4f8b\u5982\uff0c\u5728Debian\u6216Ubuntu\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528apt-get\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get update<\/p>\n<p>sudo apt-get install tesseract-ocr<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u5b89\u88c5Pytesseract\u5e93<\/p>\n<\/p>\n<p><p>Pytesseract\u662f\u4e00\u4e2a\u7528\u4e8ePython\u7684Tesseract-OCR\u5de5\u5177\u5e93\uff0c\u662fPython\u548cTesseract\u4e4b\u95f4\u7684\u6865\u6881\u3002\u53ef\u4ee5\u901a\u8fc7pip\u6765\u5b89\u88c5\u8fd9\u4e2a\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pytesseract<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u662f\u4e3a\u4e86\u8ba9Python\u7a0b\u5e8f\u80fd\u591f\u627e\u5230Tesseract\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5728Windows\u4e0a\uff0c\u627e\u5230Tesseract\u7684\u5b89\u88c5\u76ee\u5f55\uff0c\u5c06\u5176\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684PATH\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u4ee5Windows 10\u4e3a\u4f8b\uff0c\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\u627e\u5230\u201cPath\u201d\u53d8\u91cf\uff0c\u53cc\u51fb\u6253\u5f00\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u8f93\u5165Tesseract\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982\uff1a<code>C:\\Program Files\\Tesseract-OCR<\/code>\uff09\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u66f4\u6539\u3002<\/li>\n<\/ol>\n<p><p>\u5728macOS\u548cLinux\u4e0a\uff0c\u901a\u5e38\u4e0d\u9700\u8981\u989d\u5916\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u56e0\u4e3aHomebrew\u6216apt-get\u5df2\u7ecf\u5904\u7406\u4e86\u8fd9\u4e9b\u914d\u7f6e\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u7f16\u5199Python\u4ee3\u7801<\/p>\n<\/p>\n<p><p>\u5728\u5b8c\u6210\u4ee5\u4e0a\u6b65\u9aa4\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u7f16\u5199\u4ee3\u7801\u6765\u8c03\u7528Tesseract\u8fdb\u884cOCR\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from PIL import Image<\/p>\n<p>import pytesseract<\/p>\n<h2><strong>\u5982\u679c\u5728Windows\u4e0a\uff0c\u53ef\u80fd\u9700\u8981\u6307\u5b9atesseract\u7684\u8def\u5f84<\/strong><\/h2>\n<h2><strong>pytesseract.pytesseract.tesseract_cmd = r&#39;C:\\Program Files\\Tesseract-OCR\\tesseract.exe&#39;<\/strong><\/h2>\n<h2><strong>\u6253\u5f00\u56fe\u7247\u6587\u4ef6<\/strong><\/h2>\n<p>image = Image.open(&#39;example.png&#39;)<\/p>\n<h2><strong>\u4f7f\u7528tesseract\u8bc6\u522b\u56fe\u7247\u4e2d\u7684\u6587\u672c<\/strong><\/h2>\n<p>text = pytesseract.image_to_string(image)<\/p>\n<p>print(text)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528PIL\u5e93\u6253\u5f00\u4e86\u4e00\u5f20\u56fe\u7247\uff0c\u7136\u540e\u4f7f\u7528Pytesseract\u7684<code>image_to_string<\/code>\u51fd\u6570\u5bf9\u56fe\u7247\u8fdb\u884cOCR\u8bc6\u522b\uff0c\u6700\u540e\u6253\u5370\u8bc6\u522b\u51fa\u7684\u6587\u672c\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u5904\u7406OCR\u7ed3\u679c<\/p>\n<\/p>\n<p><p>\u5728\u83b7\u5f97OCR\u7ed3\u679c\u540e\uff0c\u53ef\u80fd\u9700\u8981\u5bf9\u7ed3\u679c\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u3002\u8fd9\u5305\u62ec\u53bb\u9664\u566a\u58f0\u3001\u7ea0\u6b63\u8bc6\u522b\u9519\u8bef\u3001\u683c\u5f0f\u5316\u8f93\u51fa\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u5904\u7406\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u53bb\u9664\u566a\u58f0<\/strong><br \/>OCR\u7ed3\u679c\u4e2d\u53ef\u80fd\u5305\u542b\u4e00\u4e9b\u591a\u4f59\u7684\u5b57\u7b26\u6216\u7a7a\u683c\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6216\u5b57\u7b26\u4e32\u5904\u7406\u51fd\u6570\u6765\u53bb\u9664\u8fd9\u4e9b\u566a\u58f0\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ea0\u6b63\u8bc6\u522b\u9519\u8bef<\/strong><br \/>Tesseract\u5728\u8bc6\u522b\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u4f1a\u51fa\u73b0\u9519\u8bef\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u4f4e\u8d28\u91cf\u6216\u590d\u6742\u80cc\u666f\u7684\u56fe\u7247\u65f6\u3002\u53ef\u4ee5\u4f7f\u7528\u5b57\u5178\u6216<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u6a21\u578b\u6765\u81ea\u52a8\u7ea0\u6b63\u5e38\u89c1\u7684\u8bc6\u522b\u9519\u8bef\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u683c\u5f0f\u5316\u8f93\u51fa<\/strong><br \/>\u8bc6\u522b\u51fa\u7684\u6587\u672c\u901a\u5e38\u662f\u672a\u683c\u5f0f\u5316\u7684\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u5bf9\u6587\u672c\u8fdb\u884c\u683c\u5f0f\u5316\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u7279\u5b9a\u7684\u4fe1\u606f\uff0c\u6216\u8005\u5c06\u6587\u672c\u8f6c\u6362\u4e3a\u7279\u5b9a\u7684\u683c\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u4f18\u5316OCR\u6027\u80fd<\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u63d0\u9ad8OCR\u7684\u51c6\u786e\u6027\u548c\u6027\u80fd\uff0c\u53ef\u4ee5\u8003\u8651\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u56fe\u50cf\u9884\u5904\u7406<\/strong><br \/>\u5728\u8fdb\u884cOCR\u4e4b\u524d\uff0c\u4f7f\u7528\u56fe\u50cf\u5904\u7406\u6280\u672f\u5bf9\u56fe\u50cf\u8fdb\u884c\u9884\u5904\u7406\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u8bc6\u522b\u7684\u51c6\u786e\u6027\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u8c03\u6574\u56fe\u50cf\u7684\u5bf9\u6bd4\u5ea6\u548c\u4eae\u5ea6\uff0c\u53bb\u9664\u80cc\u666f\u566a\u58f0\uff0c\u6216\u8005\u5c06\u56fe\u50cf\u8f6c\u6362\u4e3a\u7070\u5ea6\u56fe\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u8bed\u8a00\u5305<\/strong><br \/>Tesseract\u652f\u6301\u591a\u79cd\u8bed\u8a00\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u4e0b\u8f7d\u5e76\u4f7f\u7528\u7279\u5b9a\u8bed\u8a00\u7684\u8bad\u7ec3\u6570\u636e\uff0c\u4ee5\u63d0\u9ad8\u8bc6\u522b\u7684\u51c6\u786e\u6027\u3002\u5728\u8fdb\u884cOCR\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u6307\u5b9a\u4f7f\u7528\u7684\u8bed\u8a00\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8c03\u6574Tesseract\u914d\u7f6e<\/strong><br \/>Tesseract\u63d0\u4f9b\u4e86\u591a\u79cd\u914d\u7f6e\u9009\u9879\uff0c\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u8fd9\u4e9b\u9009\u9879\u6765\u4f18\u5316OCR\u7684\u6027\u80fd\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u8c03\u6574\u8bc6\u522b\u7684\u7f6e\u4fe1\u5ea6\u9608\u503c\uff0c\u6216\u8005\u4f7f\u7528\u7279\u5b9a\u7684\u8bc6\u522b\u6a21\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e03\u3001\u6269\u5c55\u5e94\u7528<\/p>\n<\/p>\n<p><p>\u4f7f\u7528Python\u94fe\u63a5Tesseract\u8fdb\u884cOCR\u4e0d\u4ec5\u9650\u4e8e\u7b80\u5355\u7684\u6587\u672c\u8bc6\u522b\uff0c\u8fd8\u53ef\u4ee5\u6269\u5c55\u5e94\u7528\u5230\u66f4\u591a\u9886\u57df\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6587\u6863\u81ea\u52a8\u5316<\/strong><br \/>OCR\u6280\u672f\u53ef\u4ee5\u7528\u4e8e\u81ea\u52a8\u5316\u5904\u7406\u5927\u91cf\u7684\u6587\u6863\uff0c\u4f8b\u5982\u6279\u91cf\u8bc6\u522b\u548c\u5206\u7c7b\u6587\u6863\uff0c\u63d0\u53d6\u7279\u5b9a\u4fe1\u606f\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u636e\u5206\u6790<\/strong><br \/>\u5c06OCR\u7ed3\u679c\u4e0e\u6570\u636e\u5206\u6790\u6280\u672f\u7ed3\u5408\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u6587\u6863\u6570\u636e\u7684\u5206\u6790\u548c\u6316\u6398\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5bf9\u8bc6\u522b\u51fa\u7684\u6587\u672c\u8fdb\u884c\u60c5\u611f\u5206\u6790\u3001\u4e3b\u9898\u5206\u7c7b\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u673a\u5668\u5b66\u4e60\u5e94\u7528<\/strong><br \/>OCR\u6280\u672f\u53ef\u4ee5\u4f5c\u4e3a\u673a\u5668\u5b66\u4e60\u5e94\u7528\u7684\u8f93\u5165\u6570\u636e\u6765\u6e90\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c06\u8bc6\u522b\u51fa\u7684\u6587\u672c\u4f5c\u4e3a\u7279\u5f81\u8f93\u5165\uff0c\u8bad\u7ec3\u6a21\u578b\u8fdb\u884c\u6587\u672c\u5206\u7c7b\u6216\u9884\u6d4b\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u6210\u529f\u94fe\u63a5Tesseract\uff0c\u5229\u7528OCR\u6280\u672f\u5b9e\u73b0\u591a\u79cd\u5e94\u7528\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6839\u636e\u5177\u4f53\u9700\u6c42\u548c\u573a\u666f\u8fdb\u884c\u4f18\u5316\u548c\u8c03\u6574\uff0c\u53ef\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u8bc6\u522b\u6548\u679c\u548c\u6027\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b89\u88c5\u548c\u914d\u7f6eTesseract-OCR\uff1f<\/strong><br \/>\u8981\u5728Python\u4e2d\u4f7f\u7528Tesseract-OCR\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Tesseract\u8f6f\u4ef6\u672c\u8eab\u3002\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95eeTesseract\u7684<a href=\"https:\/\/github.com\/tesseract-ocr\/tesseract\">GitHub\u9875\u9762<\/a>\u6765\u4e0b\u8f7d\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u7248\u672c\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u786e\u4fdd\u5c06Tesseract\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u6b64\u5916\uff0c\u60a8\u8fd8\u9700\u8981\u5b89\u88c5Python\u7684<code>pytesseract<\/code>\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip install pytesseract<\/code>\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002\u8fd9\u6837\uff0c\u60a8\u5c31\u53ef\u4ee5\u5728Python\u4e2d\u8c03\u7528Tesseract\u7684\u529f\u80fd\u4e86\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u4e0eTesseract\u8fdb\u884c\u56fe\u50cf\u6587\u672c\u8bc6\u522b\u7684\u6b65\u9aa4\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u5728\u5b89\u88c5\u597dTesseract\u548c\u76f8\u5173\u5e93\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u4e2d\u7684<code>pytesseract<\/code>\u5e93\u8fdb\u884c\u56fe\u50cf\u6587\u672c\u8bc6\u522b\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u5bfc\u5165\u5e93\u5e76\u8bfb\u53d6\u56fe\u50cf\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>PIL<\/code>\uff08Python Imaging Library\uff09\u6765\u5904\u7406\u56fe\u50cf\u3002\u63a5\u7740\uff0c\u8c03\u7528<code>pytesseract.image_to_string()<\/code>\u51fd\u6570\uff0c\u5c06\u56fe\u50cf\u4f20\u5165\uff0c\u4ee5\u63d0\u53d6\u6587\u672c\u3002\u786e\u4fdd\u4f7f\u7528\u7684\u56fe\u50cf\u8d28\u91cf\u826f\u597d\uff0c\u8fd9\u6837\u8bc6\u522b\u7684\u51c6\u786e\u6027\u4f1a\u66f4\u9ad8\u3002<\/p>\n<p><strong>\u5982\u4f55\u63d0\u9ad8Tesseract\u5728Python\u4e2d\u7684\u6587\u672c\u8bc6\u522b\u51c6\u786e\u6027\uff1f<\/strong><br \/>\u63d0\u9ad8Tesseract\u6587\u672c\u8bc6\u522b\u51c6\u786e\u6027\u7684\u5173\u952e\u5728\u4e8e\u56fe\u50cf\u9884\u5904\u7406\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528OpenCV\u7b49\u56fe\u50cf\u5904\u7406\u5e93\u5bf9\u56fe\u50cf\u8fdb\u884c\u8c03\u6574\uff0c\u4f8b\u5982\u8c03\u6574\u5bf9\u6bd4\u5ea6\u3001\u53bb\u566a\u58f0\u3001\u4e8c\u503c\u5316\u7b49\u3002\u8fd9\u4e9b\u9884\u5904\u7406\u6b65\u9aa4\u53ef\u4ee5\u663e\u8457\u6539\u5584\u8bc6\u522b\u6548\u679c\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u9009\u62e9\u5408\u9002\u7684\u8bed\u8a00\u5305\u548c\u914d\u7f6e\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u8fdb\u4e00\u6b65\u63d0\u9ad8\u8bc6\u522b\u7684\u51c6\u786e\u6027\u3002\u5728<code>pytesseract<\/code>\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7<code>config<\/code>\u53c2\u6570\u4f20\u9012\u81ea\u5b9a\u4e49\u9009\u9879\uff0c\u4ee5\u4f18\u5316\u8bc6\u522b\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4f7f\u7528Python\u94fe\u63a5Tesseract\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a\u5b89\u88c5Tesseract\u3001\u5b89\u88c5Pytesseract\u5e93\u3001\u914d [&hellip;]","protected":false},"author":3,"featured_media":1002828,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1002814"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1002814"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1002814\/revisions"}],"predecessor-version":[{"id":1002831,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1002814\/revisions\/1002831"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1002828"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1002814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1002814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1002814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}