{"id":961144,"date":"2024-12-27T03:56:02","date_gmt":"2024-12-26T19:56:02","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/961144.html"},"modified":"2024-12-27T03:56:04","modified_gmt":"2024-12-26T19:56:04","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e8%af%86%e5%88%ab%e6%96%87%e5%ad%97","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/961144.html","title":{"rendered":"\u5982\u4f55\u7528python\u8bc6\u522b\u6587\u5b57"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25103434\/23e82b43-0f03-401d-aee1-1e48a1266106.webp\" alt=\"\u5982\u4f55\u7528python\u8bc6\u522b\u6587\u5b57\" \/><\/p>\n<p><p> <strong>\u8981\u7528Python\u8bc6\u522b\u6587\u5b57\uff0c\u53ef\u4ee5\u4f7f\u7528OCR\u6280\u672f\u3001\u5e38\u7528\u7684\u5e93\u6709Tesseract OCR\u3001\u5229\u7528Pytesseract\u548cOpenCV\u8fdb\u884c\u56fe\u50cf\u9884\u5904\u7406\u3001\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u5982EasyOCR\u3002<\/strong> OCR\uff08Optical Character Recognition\uff09\u6280\u672f\u662f\u5c06\u56fe\u50cf\u4e2d\u7684\u6587\u5b57\u8f6c\u5316\u4e3a\u673a\u5668\u53ef\u8bfb\u6587\u672c\u7684\u8fc7\u7a0b\u3002Tesseract OCR\u662f\u4e00\u4e2a\u5f00\u6e90\u7684OCR\u5f15\u64ce\uff0c\u7ed3\u5408Pytesseract\u5e93\u53ef\u4ee5\u8f7b\u677e\u5728Python\u4e2d\u5b9e\u73b0\u6587\u5b57\u8bc6\u522b\u3002OpenCV\u7528\u4e8e\u56fe\u50cf\u5904\u7406\u548c\u589e\u5f3a\uff0c\u80fd\u591f\u63d0\u9ad8OCR\u7684\u51c6\u786e\u6027\u3002\u6b64\u5916\uff0cEasyOCR\u662f\u4e00\u4e2a\u57fa\u4e8e\u6df1\u5ea6\u5b66\u4e60\u7684OCR\u5e93\uff0c\u652f\u6301\u591a\u79cd\u8bed\u8a00\u7684\u6587\u5b57\u8bc6\u522b\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u6765\u5b9e\u73b0\u6587\u5b57\u8bc6\u522b\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001OCR\u6280\u672f\u6982\u8ff0<\/h3>\n<\/p>\n<p><p>OCR\u6280\u672f\u662f\u8ba1\u7b97\u673a\u89c6\u89c9\u7684\u4e00\u4e2a\u91cd\u8981\u5206\u652f\uff0c\u80fd\u591f\u4ece\u56fe\u50cf\u3001\u626b\u63cf\u6587\u6863\u6216\u7167\u7247\u4e2d\u63d0\u53d6\u51fa\u53ef\u7f16\u8f91\u7684\u6587\u672c\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u6d89\u53ca\u591a\u4e2a\u6b65\u9aa4\uff0c\u5305\u62ec\u56fe\u50cf\u9884\u5904\u7406\u3001\u6587\u5b57\u68c0\u6d4b\u3001\u5b57\u7b26\u8bc6\u522b\u7b49\u3002OCR\u6280\u672f\u5728\u8bb8\u591a\u9886\u57df\u90fd\u6709\u5e7f\u6cdb\u5e94\u7528\uff0c\u6bd4\u5982\u6587\u6863\u81ea\u52a8\u5316\u3001\u6570\u636e\u5f55\u5165\u81ea\u52a8\u5316\u3001\u8f66\u724c\u8bc6\u522b\u7b49\u3002<\/p>\n<\/p>\n<p><p><strong>1. Tesseract OCR<\/strong><\/p>\n<\/p>\n<p><p>Tesseract\u662f\u4e00\u4e2a\u5f00\u6e90\u7684OCR\u5f15\u64ce\uff0c\u7531Google\u7ef4\u62a4\u3002\u5b83\u652f\u6301\u591a\u79cd\u8bed\u8a00\uff0c\u7ecf\u8fc7\u591a\u5e74\u7684\u53d1\u5c55\uff0c\u5df2\u7ecf\u6210\u4e3a\u6700\u6210\u719f\u548c\u5e7f\u6cdb\u4f7f\u7528\u7684OCR\u5f15\u64ce\u4e4b\u4e00\u3002Tesseract\u7684\u6838\u5fc3\u529f\u80fd\u662f\u5c06\u56fe\u50cf\u4e2d\u7684\u6587\u5b57\u8f6c\u6362\u4e3a\u6587\u672c\uff0c\u5b83\u80fd\u591f\u5904\u7406\u4e0d\u540c\u7684\u5b57\u4f53\u3001\u683c\u5f0f\u548c\u8bed\u8a00\u3002<\/p>\n<\/p>\n<p><p><strong>2. Pytesseract<\/strong><\/p>\n<\/p>\n<p><p>Pytesseract\u662f\u4e00\u4e2aPython\u5e93\uff0c\u662fTesseract OCR\u7684Python\u5305\u88c5\u5668\u3002\u5b83\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u63a5\u53e3\uff0c\u4f7f\u5f97\u5728Python\u4e2d\u4f7f\u7528Tesseract\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002\u901a\u8fc7Pytesseract\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728Python\u4ee3\u7801\u4e2d\u8c03\u7528Tesseract\u7684\u529f\u80fd\uff0c\u5b9e\u73b0\u6587\u5b57\u8bc6\u522b\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u5b89\u88c5\u548c\u73af\u5883\u914d\u7f6e<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528Pytesseract\u8fdb\u884c\u6587\u5b57\u8bc6\u522b\u4e4b\u524d\uff0c\u9700\u8981\u5148\u5b89\u88c5Tesseract OCR\u5f15\u64ce\u548cPytesseract\u5e93\u3002<\/p>\n<\/p>\n<p><p><strong>1. \u5b89\u88c5Tesseract OCR<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u9700\u8981\u5b89\u88c5Tesseract OCR\u5f15\u64ce\u3002\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e0b\u8f7d<a href=\"https:\/\/github.com\/UB-Mannheim\/tesseract\/wiki\">Tesseract OCR\u7684\u5b89\u88c5\u5305<\/a>\u8fdb\u884c\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\u3002<\/p>\n<\/p>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5305\u7ba1\u7406\u5668\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<p><p><strong>2. \u5b89\u88c5Pytesseract<\/strong><\/p>\n<\/p>\n<p><p>Pytesseract\u53ef\u4ee5\u901a\u8fc7pip\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pytesseract<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u56fe\u50cf\u9884\u5904\u7406<\/h3>\n<\/p>\n<p><p>\u56fe\u50cf\u9884\u5904\u7406\u662f\u63d0\u9ad8OCR\u8bc6\u522b\u7cbe\u5ea6\u7684\u91cd\u8981\u6b65\u9aa4\u3002\u901a\u8fc7OpenCV\u7b49\u5de5\u5177\uff0c\u53ef\u4ee5\u5bf9\u56fe\u50cf\u8fdb\u884c\u53bb\u566a\u3001\u4e8c\u503c\u5316\u3001\u8fb9\u7f18\u68c0\u6d4b\u7b49\u5904\u7406\uff0c\u4ece\u800c\u63d0\u9ad8\u6587\u5b57\u8bc6\u522b\u7684\u51c6\u786e\u6027\u3002<\/p>\n<\/p>\n<p><p><strong>1. \u56fe\u50cf\u7070\u5ea6\u5316<\/strong><\/p>\n<\/p>\n<p><p>\u7070\u5ea6\u5316\u662f\u5c06\u5f69\u8272\u56fe\u50cf\u8f6c\u5316\u4e3a\u7070\u5ea6\u56fe\u50cf\u7684\u8fc7\u7a0b\uff0c\u8fd9\u53ef\u4ee5\u51cf\u5c11\u56fe\u50cf\u7684\u989c\u8272\u4fe1\u606f\uff0c\u4f7f\u5f97\u540e\u7eed\u5904\u7406\u66f4\u4e3a\u7b80\u5355\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cv2<\/p>\n<h2><strong>\u8bfb\u53d6\u56fe\u50cf<\/strong><\/h2>\n<p>image = cv2.imread(&#39;image.png&#39;)<\/p>\n<h2><strong>\u8f6c\u6362\u4e3a\u7070\u5ea6\u56fe\u50cf<\/strong><\/h2>\n<p>gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>2. \u4e8c\u503c\u5316\u5904\u7406<\/strong><\/p>\n<\/p>\n<p><p>\u4e8c\u503c\u5316\u662f\u5c06\u56fe\u50cf\u4e2d\u7684\u50cf\u7d20\u70b9\u8f6c\u5316\u4e3a\u9ed1\u767d\u4e24\u79cd\u989c\u8272\uff0c\u8fd9\u6709\u52a9\u4e8e\u63d0\u9ad8OCR\u7684\u8bc6\u522b\u6548\u679c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5e94\u7528\u4e8c\u503c\u5316<\/p>\n<p>_, binary_image = cv2.threshold(gray_image, 128, 255, cv2.THRESH_BINARY)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>3. \u566a\u58f0\u53bb\u9664<\/strong><\/p>\n<\/p>\n<p><p>\u566a\u58f0\u53bb\u9664\u53ef\u4ee5\u51cf\u5c11\u56fe\u50cf\u4e2d\u7684\u5e72\u6270\u4fe1\u606f\uff0c\u63d0\u9ad8\u6587\u5b57\u8bc6\u522b\u7684\u51c6\u786e\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u4f7f\u7528\u9ad8\u65af\u6a21\u7cca\u53bb\u9664\u566a\u58f0<\/p>\n<p>blurred_image = cv2.GaussianBlur(binary_image, (5, 5), 0)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528Pytesseract\u8fdb\u884c\u6587\u5b57\u8bc6\u522b<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7Pytesseract\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u9884\u5904\u7406\u540e\u7684\u56fe\u50cf\u8f6c\u6362\u4e3a\u6587\u672c\u3002<\/p>\n<\/p>\n<p><p><strong>1. \u57fa\u672c\u4f7f\u7528<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5c55\u793a\u5982\u4f55\u4f7f\u7528Pytesseract\u8bc6\u522b\u56fe\u50cf\u4e2d\u7684\u6587\u5b57\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pytesseract<\/p>\n<h2><strong>\u8bbe\u7f6eTesseract\u547d\u4ee4\u8def\u5f84<\/strong><\/h2>\n<p>pytesseract.pytesseract.tesseract_cmd = r&#39;C:\\Program Files\\Tesseract-OCR\\tesseract.exe&#39;<\/p>\n<h2><strong>\u8bc6\u522b\u6587\u5b57<\/strong><\/h2>\n<p>text = pytesseract.image_to_string(blurred_image)<\/p>\n<p>print(text)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>2. \u8bc6\u522b\u4e0d\u540c\u8bed\u8a00\u7684\u6587\u5b57<\/strong><\/p>\n<\/p>\n<p><p>Tesseract\u652f\u6301\u591a\u79cd\u8bed\u8a00\u7684\u6587\u5b57\u8bc6\u522b\u3002\u5728\u8bc6\u522b\u4e0d\u540c\u8bed\u8a00\u7684\u6587\u5b57\u65f6\uff0c\u9700\u8981\u6307\u5b9a\u8bed\u8a00\u53c2\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8bc6\u522b\u4e2d\u6587\u6587\u672c<\/p>\n<p>text_cn = pytesseract.image_to_string(blurred_image, lang=&#39;chi_sim&#39;)<\/p>\n<p>print(text_cn)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>3. \u63d0\u53d6\u56fe\u50cf\u4e2d\u7684\u7279\u5b9a\u533a\u57df<\/strong><\/p>\n<\/p>\n<p><p>\u6709\u65f6\u53ea\u9700\u8981\u8bc6\u522b\u56fe\u50cf\u4e2d\u7684\u7279\u5b9a\u533a\u57df\uff0c\u53ef\u4ee5\u901a\u8fc7OpenCV\u88c1\u526a\u56fe\u50cf\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u88c1\u526a\u56fe\u50cf<\/p>\n<p>roi = blurred_image[y:y+h, x:x+w]<\/p>\n<h2><strong>\u8bc6\u522b\u88c1\u526a\u533a\u57df\u4e2d\u7684\u6587\u5b57<\/strong><\/h2>\n<p>text_roi = pytesseract.image_to_string(roi)<\/p>\n<p>print(text_roi)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528EasyOCR\u8fdb\u884c\u6587\u5b57\u8bc6\u522b<\/h3>\n<\/p>\n<p><p>EasyOCR\u662f\u4e00\u4e2a\u57fa\u4e8e\u6df1\u5ea6\u5b66\u4e60\u7684OCR\u5e93\uff0c\u652f\u6301\u8d85\u8fc780\u79cd\u8bed\u8a00\u7684\u6587\u5b57\u8bc6\u522b\u3002EasyOCR\u5728\u5904\u7406\u590d\u6742\u80cc\u666f\u548c\u4e0d\u540c\u5b57\u4f53\u7684\u6587\u5b57\u8bc6\u522b\u65f6\u8868\u73b0\u4f18\u5f02\u3002<\/p>\n<\/p>\n<p><p><strong>1. \u5b89\u88c5EasyOCR<\/strong><\/p>\n<\/p>\n<p><p>EasyOCR\u53ef\u4ee5\u901a\u8fc7pip\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install easyocr<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>2. \u4f7f\u7528EasyOCR\u8fdb\u884c\u8bc6\u522b<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528EasyOCR\u8bc6\u522b\u56fe\u50cf\u6587\u5b57\u7684\u4f8b\u5b50\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import easyocr<\/p>\n<h2><strong>\u521b\u5efaEasyOCR\u9605\u8bfb\u5668<\/strong><\/h2>\n<p>reader = easyocr.Reader([&#39;en&#39;, &#39;ch_sim&#39;])<\/p>\n<h2><strong>\u8bc6\u522b\u6587\u5b57<\/strong><\/h2>\n<p>result = reader.readtext(&#39;image.png&#39;)<\/p>\n<h2><strong>\u8f93\u51fa\u8bc6\u522b\u7ed3\u679c<\/strong><\/h2>\n<p>for detection in result:<\/p>\n<p>    text = detection[1]<\/p>\n<p>    print(text)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>3. \u5904\u7406\u590d\u6742\u80cc\u666f\u7684\u56fe\u50cf<\/strong><\/p>\n<\/p>\n<p><p>EasyOCR\u80fd\u591f\u5f88\u597d\u5730\u5904\u7406\u590d\u6742\u80cc\u666f\u7684\u56fe\u50cf\uff0c\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\u80fd\u591f\u53d6\u5f97\u6bd4Tesseract\u66f4\u597d\u7684\u6548\u679c\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u63d0\u9ad8OCR\u8bc6\u522b\u51c6\u786e\u6027\u7684\u6280\u5de7<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u63d0\u9ad8OCR\u7684\u8bc6\u522b\u51c6\u786e\u6027\uff0c\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\u8fdb\u884c\u4f18\u5316\uff1a<\/p>\n<\/p>\n<p><p><strong>1. \u56fe\u50cf\u9884\u5904\u7406<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u5bf9\u56fe\u50cf\u8fdb\u884c\u7070\u5ea6\u5316\u3001\u4e8c\u503c\u5316\u3001\u53bb\u566a\u7b49\u5904\u7406\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8OCR\u7684\u8bc6\u522b\u7cbe\u5ea6\u3002<\/p>\n<\/p>\n<p><p><strong>2. \u4f7f\u7528\u5408\u9002\u7684\u8bed\u8a00\u6a21\u578b<\/strong><\/p>\n<\/p>\n<p><p>\u6839\u636e\u6587\u672c\u7684\u8bed\u8a00\u9009\u62e9\u5408\u9002\u7684\u8bed\u8a00\u6a21\u578b\uff0c\u80fd\u591f\u63d0\u9ad8\u8bc6\u522b\u7684\u51c6\u786e\u6027\u3002<\/p>\n<\/p>\n<p><p><strong>3. \u589e\u5f3a\u56fe\u50cf\u5bf9\u6bd4\u5ea6<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u8c03\u6574\u56fe\u50cf\u5bf9\u6bd4\u5ea6\uff0c\u53ef\u4ee5\u7a81\u51fa\u6587\u5b57\u90e8\u5206\uff0c\u51cf\u5c11\u80cc\u666f\u5e72\u6270\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u589e\u5f3a\u56fe\u50cf\u5bf9\u6bd4\u5ea6<\/p>\n<p>enhanced_image = cv2.convertScaleAbs(gray_image, alpha=1.5, beta=0)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>4. \u9009\u62e9\u5408\u9002\u7684OCR\u5de5\u5177<\/strong><\/p>\n<\/p>\n<p><p>\u6839\u636e\u5177\u4f53\u573a\u666f\u9009\u62e9\u5408\u9002\u7684OCR\u5de5\u5177\u3002\u5bf9\u4e8e\u7b80\u5355\u80cc\u666f\u7684\u6587\u5b57\uff0cTesseract\u53ef\u80fd\u8db3\u591f\uff1b\u800c\u5bf9\u4e8e\u590d\u6742\u80cc\u666f\u6216\u591a\u8bed\u8a00\u7684\u6587\u5b57\uff0cEasyOCR\u53ef\u80fd\u6548\u679c\u66f4\u597d\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u5de5\u5177\u548c\u5e93\u6765\u5b9e\u73b0\u6587\u5b57\u8bc6\u522b\uff0c\u901a\u8fc7\u5408\u7406\u7684\u9009\u62e9\u548c\u914d\u7f6e\uff0c\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\u4e2d\u5b9e\u73b0\u9ad8\u6548\u7684\u6587\u5b57\u8bc6\u522b\u3002\u65e0\u8bba\u662f\u4f7f\u7528Tesseract\u7ed3\u5408Pytesseract\u8fdb\u884c\u7b80\u5355\u7684OCR\u4efb\u52a1\uff0c\u8fd8\u662f\u4f7f\u7528EasyOCR\u5904\u7406\u590d\u6742\u7684\u591a\u8bed\u8a00\u6587\u672c\uff0cPython\u90fd\u80fd\u63d0\u4f9b\u5f3a\u5927\u7684\u652f\u6301\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5408\u7406\u7684\u56fe\u50cf\u9884\u5904\u7406\u548c\u5de5\u5177\u9009\u62e9\u662f\u63d0\u9ad8OCR\u6548\u679c\u7684\u5173\u952e\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>Python\u53ef\u4ee5\u8bc6\u522b\u54ea\u4e9b\u7c7b\u578b\u7684\u6587\u5b57\uff1f<\/strong><br \/>Python\u80fd\u591f\u8bc6\u522b\u591a\u79cd\u7c7b\u578b\u7684\u6587\u5b57\uff0c\u5305\u62ec\u5370\u5237\u4f53\u3001\u624b\u5199\u4f53\u4ee5\u53ca\u5404\u79cd\u8bed\u8a00\u7684\u6587\u5b57\u3002\u901a\u8fc7\u4f7f\u7528\u5149\u5b66\u5b57\u7b26\u8bc6\u522b\uff08OCR\uff09\u5e93\uff0c\u5982Tesseract\u6216EasyOCR\uff0c\u7528\u6237\u53ef\u4ee5\u63d0\u53d6\u56fe\u50cf\u4e2d\u7684\u6587\u672c\u4fe1\u606f\u3002\u8fd9\u4e9b\u5e93\u652f\u6301\u591a\u79cd\u5b57\u4f53\u548c\u683c\u5f0f\uff0c\u9002\u7528\u4e8e\u5404\u79cd\u5e94\u7528\u573a\u666f\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u8fdb\u884c\u6587\u5b57\u8bc6\u522b\u9700\u8981\u54ea\u4e9b\u5e93\u6216\u5de5\u5177\uff1f<\/strong><br \/>\u4e3a\u4e86\u5728Python\u4e2d\u8fdb\u884c\u6587\u5b57\u8bc6\u522b\uff0c\u901a\u5e38\u9700\u8981\u5b89\u88c5OCR\u5e93\uff0c\u4f8b\u5982Tesseract-OCR\u548cPillow\uff08\u7528\u4e8e\u56fe\u50cf\u5904\u7406\uff09\u3002\u6b64\u5916\uff0c\u4e00\u4e9b\u9ad8\u7ea7\u5e93\u5982OpenCV\u4e5f\u53ef\u4ee5\u7528\u4e8e\u56fe\u50cf\u9884\u5904\u7406\uff0c\u4ee5\u63d0\u9ad8\u6587\u5b57\u8bc6\u522b\u7684\u51c6\u786e\u6027\u3002\u5b89\u88c5\u8fd9\u4e9b\u5e93\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u4ee3\u7801\u8fdb\u884c\u6587\u5b57\u8bc6\u522b\u3002<\/p>\n<p><strong>\u6587\u5b57\u8bc6\u522b\u7684\u51c6\u786e\u6027\u5982\u4f55\u63d0\u9ad8\uff1f<\/strong><br \/>\u63d0\u9ad8\u6587\u5b57\u8bc6\u522b\u51c6\u786e\u6027\u7684\u7b56\u7565\u5305\u62ec\u9009\u62e9\u9ad8\u8d28\u91cf\u7684\u8f93\u5165\u56fe\u50cf\u3001\u4f7f\u7528\u9002\u5f53\u7684\u56fe\u50cf\u9884\u5904\u7406\u6280\u672f\uff08\u5982\u53bb\u566a\u58f0\u3001\u4e8c\u503c\u5316\u548c\u8fb9\u7f18\u68c0\u6d4b\uff09\uff0c\u4ee5\u53ca\u8c03\u6574OCR\u7b97\u6cd5\u7684\u53c2\u6570\u4ee5\u9002\u5e94\u7279\u5b9a\u7684\u6587\u672c\u7c7b\u578b\u3002\u6b64\u5916\uff0c\u8bad\u7ec3\u81ea\u5b9a\u4e49\u7684OCR\u6a21\u578b\u4ee5\u8bc6\u522b\u7279\u5b9a\u5b57\u4f53\u6216\u8bed\u8a00\u4e5f\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u8bc6\u522b\u6548\u679c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u7528Python\u8bc6\u522b\u6587\u5b57\uff0c\u53ef\u4ee5\u4f7f\u7528OCR\u6280\u672f\u3001\u5e38\u7528\u7684\u5e93\u6709Tesseract OCR\u3001\u5229\u7528Pytesseract [&hellip;]","protected":false},"author":3,"featured_media":961149,"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\/961144"}],"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=961144"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/961144\/revisions"}],"predecessor-version":[{"id":961153,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/961144\/revisions\/961153"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/961149"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=961144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=961144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=961144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}