├── .gitignore ├── 1.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.png ├── 16.png ├── 17.png ├── 18.png ├── 19.png ├── 2.png ├── 20.png ├── 21.png ├── 22.png ├── 23.png ├── 24.png ├── 25.png ├── 26.png ├── 27.png ├── 28.png ├── 29.png ├── 3.png ├── 30.png ├── 31.png ├── 32.png ├── 33.png ├── 34.png ├── 35.png ├── 36.png ├── 37.png ├── 38.png ├── 39.png ├── 4.png ├── 40.png ├── 41.png ├── 42.png ├── 43.png ├── 44.png ├── 45.png ├── 46.png ├── 47.png ├── 48.png ├── 49.png ├── 5.png ├── 50.png ├── 6.png ├── 7.png ├── 8.png ├── 9.png ├── LICENSE ├── README.md ├── main.py └── new_main_GUI_Pic2str.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/1.png -------------------------------------------------------------------------------- /10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/10.png -------------------------------------------------------------------------------- /11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/11.png -------------------------------------------------------------------------------- /12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/12.png -------------------------------------------------------------------------------- /13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/13.png -------------------------------------------------------------------------------- /14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/14.png -------------------------------------------------------------------------------- /15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/15.png -------------------------------------------------------------------------------- /16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/16.png -------------------------------------------------------------------------------- /17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/17.png -------------------------------------------------------------------------------- /18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/18.png -------------------------------------------------------------------------------- /19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/19.png -------------------------------------------------------------------------------- /2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/2.png -------------------------------------------------------------------------------- /20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/20.png -------------------------------------------------------------------------------- /21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/21.png -------------------------------------------------------------------------------- /22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/22.png -------------------------------------------------------------------------------- /23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/23.png -------------------------------------------------------------------------------- /24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/24.png -------------------------------------------------------------------------------- /25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/25.png -------------------------------------------------------------------------------- /26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/26.png -------------------------------------------------------------------------------- /27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/27.png -------------------------------------------------------------------------------- /28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/28.png -------------------------------------------------------------------------------- /29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/29.png -------------------------------------------------------------------------------- /3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/3.png -------------------------------------------------------------------------------- /30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/30.png -------------------------------------------------------------------------------- /31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/31.png -------------------------------------------------------------------------------- /32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/32.png -------------------------------------------------------------------------------- /33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/33.png -------------------------------------------------------------------------------- /34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/34.png -------------------------------------------------------------------------------- /35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/35.png -------------------------------------------------------------------------------- /36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/36.png -------------------------------------------------------------------------------- /37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/37.png -------------------------------------------------------------------------------- /38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/38.png -------------------------------------------------------------------------------- /39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/39.png -------------------------------------------------------------------------------- /4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/4.png -------------------------------------------------------------------------------- /40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/40.png -------------------------------------------------------------------------------- /41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/41.png -------------------------------------------------------------------------------- /42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/42.png -------------------------------------------------------------------------------- /43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/43.png -------------------------------------------------------------------------------- /44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/44.png -------------------------------------------------------------------------------- /45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/45.png -------------------------------------------------------------------------------- /46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/46.png -------------------------------------------------------------------------------- /47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/47.png -------------------------------------------------------------------------------- /48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/48.png -------------------------------------------------------------------------------- /49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/49.png -------------------------------------------------------------------------------- /5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/5.png -------------------------------------------------------------------------------- /50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/50.png -------------------------------------------------------------------------------- /6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/6.png -------------------------------------------------------------------------------- /7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/7.png -------------------------------------------------------------------------------- /8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/8.png -------------------------------------------------------------------------------- /9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MTmingggg/Business-information-picture-OCR-Model/6ccdefe01e58985a3a74d1be3c1ab994f19b48b2/9.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Business-information-picture-OCR-Model 2 | 本模型是基于Python3编写的工商信息图片识别文字模型。主要步骤包括去噪、分离水印、反色、二值化增强等,支持批量图片处理。 3 | # IDE 4 | Pycharm2018.2+Anaconda3 5 | # 免责 6 | 所有图片资源均为已公开信息,由第三方机构合法提供。 7 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import os 2 | from PIL import Image,ImageFilter,ImageEnhance 3 | import time 4 | import cv2 5 | import numpy 6 | import glob 7 | import os 8 | import datetime 9 | 10 | #新建目标文件夹 11 | def mkdir(path): 12 | path = path.strip() 13 | path = path.rstrip("\\") 14 | 15 | isExists = os.path.exists(path) 16 | if not isExists: 17 | os.makedirs(path) 18 | return True 19 | else: 20 | return False 21 | 22 | #主 图片预处理 23 | def imgTransfer(im): 24 | im = im.filter(ImageFilter.MedianFilter(1)) 25 | im = ImageEnhance.Contrast(im).enhance(1.5) 26 | im = im.convert('L') # 灰度图转换 27 | im = denoising(im) # 图片去噪 28 | imgc = binarizing(im, 200) # 图片二值化 29 | return imgc 30 | 31 | #去噪 32 | def denoising(im): 33 | pixdata = im.load() 34 | w, h = im.size 35 | for j in range(1, h - 1): 36 | for i in range(1, w - 1): 37 | count = 0 38 | if pixdata[i, j - 1] > 245: 39 | count = count + 1 40 | if pixdata[i, j + 1] > 245: 41 | count = count + 1 42 | if pixdata[i + 1, j] > 245: 43 | count = count + 1 44 | if pixdata[i - 1, j] > 245: 45 | count = count + 1 46 | if count > 2: 47 | pixdata[i, j] = 255 48 | return im 49 | 50 | #图片增强,二值化函数 51 | def binarizing(im, threshold): 52 | pixdata = im.load() 53 | w, h = im.size 54 | for j in range(h): 55 | for i in range(w): 56 | if pixdata[i, j] < threshold: 57 | pixdata[i, j] = 255 58 | else: 59 | pixdata[i, j] = 0 60 | return im 61 | 62 | #反色。把黑底变白底255,把不是白底的(字)变为黑色0 63 | def inverse_color(image): 64 | for row in range(src.shape[0]): 65 | for col in range(src.shape[1]): 66 | for channel in range(src.shape[2]): 67 | if mask[row, col, channel] == 0: 68 | val = 0 69 | else: 70 | reverse_val = 255 - src[row, col, channel] 71 | val = 255 - reverse_val * 256 / mask[row, col, channel] 72 | if val < 0: 73 | val = 0 74 | image[row, col, channel] = val 75 | height,width,_ = image.shape 76 | img2 = image.copy() 77 | for i in range(height): 78 | for j in range(width): 79 | img2[i,j] = (255-image[i,j]) 80 | if img2[i, j].sum(axis=None, dtype=None, out=None)!=765: 81 | img2[i,j] = 0 82 | return img2 83 | 84 | #删除中间缓存图片 85 | def delete_file(src): 86 | if os.path.isfile(src): 87 | try: 88 | os.remove(src) 89 | except: 90 | pass 91 | elif os.path.isdir(src): 92 | for item in os.listdir(src): 93 | itemsrc=os.path.join(src,item) 94 | delete_file(itemsrc) 95 | try: 96 | os.rmdir(src) 97 | except: 98 | pass 99 | 100 | if __name__ == '__main__': 101 | srcpath = "E:/tianmao" 102 | maskpath = "E:/mask" 103 | finpath = "E:/fin" 104 | 105 | mkpath = maskpath 106 | mkdir(mkpath) 107 | mkpath = finpath 108 | mkdir(mkpath) 109 | 110 | for filepath in os.listdir(srcpath): 111 | filename1 = os.path.splitext(filepath)[1] 112 | filename1 = filename1.lower() 113 | if filename1 == '.jpg' or filename1 == '.png' or filename1 == '.jpeg' or filename1 == '.bmp': 114 | 115 | src = cv2.imread(filepath) 116 | start = time.clock() 117 | print("正在生成" + (filepath) + "水印图...") 118 | im = Image.open(filepath) 119 | imgc = imgTransfer(im) # 图片预处理,二值化,图片增强 120 | imgc.save(os.path.join(maskpath, os.path.basename(filepath))) 121 | print("当前水印图生成完毕") 122 | mask = cv2.imread(os.path.join(maskpath, os.path.basename(filepath))) 123 | print("已获取原图: " + (filepath)) 124 | print("已获取其水印图: " + (os.path.join(maskpath, os.path.basename(filepath)))) 125 | print ("正在生成,请稍后...") 126 | saver = numpy.zeros(src.shape, numpy.uint8) 127 | result = inverse_color(saver) 128 | cv2.imwrite((finpath) + "/" + (filepath), result) 129 | end = time.clock() 130 | print ("耗时" + str(round(end - start)) + "秒") 131 | print("当前测试图片生成完毕!" + "\n") 132 | 133 | dirname = maskpath 134 | delete_file(dirname) 135 | print("结束!") -------------------------------------------------------------------------------- /new_main_GUI_Pic2str.py: -------------------------------------------------------------------------------- 1 | from tkinter import * #@UnusedWildImport 2 | from tkinter import filedialog #@Reimport 3 | import os 4 | import time 5 | from PIL import Image 6 | import pytesseract 7 | import xlrd 8 | import xlwt 9 | import re 10 | import sys 11 | import threading 12 | from threading import Lock 13 | import math 14 | 15 | def fun(): 16 | write_log_to_Text("识别中,请稍等...") 17 | filepath = init_Text.get(1.0, END).strip()#获取输入框中的值 = init_Text.get(1.0, END).strip()#获取输入框中的值 18 | # 将文件名列表重新排序# 19 | # 没有xxpng.png干扰的顺序读取 20 | const = 4 #线程数,可更改 21 | filelist = os.listdir(filepath) 22 | filelist.sort(key=lambda x: int(x[:-4])) 23 | thradsum = int(math.ceil(len(filelist) / const))#计算给每个线程分配的资源数, 24 | thl = []#线程的集合 25 | biglist = []#分配资源的集合 26 | count = 0#计数器 27 | #创建5个线程, 28 | for i in range(const): 29 | biglist.append([]) 30 | if len(filelist) - count >= thradsum: 31 | for x in range(thradsum): 32 | biglist[i].append(os.path.join(filepath, filelist[count])) 33 | count += 1 34 | else: 35 | for x in range(len(filelist) - count): 36 | biglist[i].append(os.path.join(filepath, filelist[count])) 37 | count += 1 38 | 39 | th1 = threading.Thread(target=init, args=(biglist[i],)) 40 | thl.append(th1) 41 | for t in thl: 42 | t.setDaemon(True) 43 | t.start() 44 | # dir1 = [] 45 | # dir2 = [] 46 | # dir3 = [] 47 | # dir4 = [] 48 | # dir5 = [] 49 | # for x in range(0, 10): 50 | # dir1.append(os.path.join(filepath, filelist[x])) 51 | # th1 = threading.Thread(target=init, args=(dir1,)) 52 | # thl.append(th1) 53 | # 54 | # for x in range(10, 20): 55 | # dir2.append(os.path.join(filepath, filelist[x])) 56 | # th2 = threading.Thread(target=init, args=(dir2,)) 57 | # thl.append(th2) 58 | # 59 | # for x in range(20, 30): 60 | # dir3.append(os.path.join(filepath, filelist[x])) 61 | # th3 = threading.Thread(target=init, args=(dir3,)) 62 | # thl.append(th3) 63 | # 64 | # for x in range(30, 40): 65 | # dir4.append(os.path.join(filepath, filelist[x])) 66 | # th4 = threading.Thread(target=init, args=(dir4,)) 67 | # thl.append(th4) 68 | # 69 | # for x in range(40, 50): 70 | # dir5.append(os.path.join(filepath, filelist[x])) 71 | # th5 = threading.Thread(target=init, args=(dir5,)) 72 | # thl.append(th5) 73 | # print(thl) 74 | # print(len(thl)) 75 | 76 | #将文件夹内图片重命名,排除不规范文件名 77 | def re_name(filepath): 78 | # file_list 文件夹下文件名的列表,以字符串方式排序 79 | file_list = os.listdir(filepath) 80 | for filename in file_list: 81 | oldname = filepath + '/' + filename 82 | file_num = re.compile('\d+', re.S) 83 | i = int(file_num.findall(filename)[0]) 84 | newname = filepath + '/' + "%d" % i + ".png" 85 | # print(newname) 86 | os.rename(oldname, newname) 87 | 88 | #功能函数 89 | #点击选择文件按钮之后调用的第一个函数 90 | def openfile():#打开文件调用函数 91 | path = filedialog.askopenfilename(title='打开文件', filetypes=[('PNG', '*.png *.PNG'), ('All Files', '*')]) 92 | dols(path) 93 | 94 | #将所选路径写入到选择文件的输入框中.并在日志信息框中输出成功 95 | 96 | def dols(selectdir): 97 | if os.path.isfile(selectdir):#判断是不是一个文件,空文件也返回false 98 | filepath = os.path.split(selectdir)[0] 99 | 100 | # 获取文件名列表 101 | filelist = os.listdir(filepath) 102 | # 调用re_name函数,将不规范文件名规范化 103 | re_name(filepath) 104 | # 将文件名列表重新排序# 105 | # 没有xxpng.png干扰的顺序读取 106 | filelist.sort(key=lambda x: int(x[:-4]), reverse=True) 107 | init_Text.delete(1.0, END)#防止重复写路径 108 | init_Text.insert(1.0, filepath) 109 | if os.path.isdir(filepath): #判断name是不是一个目录,不是目录就返回false 110 | for s in filelist: 111 | result_Text.insert(1.0, s + '\n') 112 | write_log_to_Text("导入目录成功" + "\n" + "点击【全部识别】后开始...") 113 | 114 | #保存 115 | #def savefile(self):#打开文件调用函数 116 | # s = filedialog.askopenfilename(title='打开文件', filetypes=[('All Files', '*')]) 117 | # if os.path.isfile(s):#判断是不是一个文件,空文件也返回false 118 | # dir = os.path.split(s)[0] 119 | # self.save_Text.insert(1.0, dir) 120 | # self.save_button.bind("", pic2str.main(r)) 121 | 122 | #日志动态打印 123 | def write_log_to_Text(logmsg): 124 | #获取当前时间 125 | current_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) 126 | logmsg_in = str(current_time) + " " + str(logmsg) + "\n" #换行 127 | log_Text.insert(END, logmsg_in) 128 | init_window.update() 129 | 130 | #以下函数是识别图片的 131 | def NumAndName(str): 132 | result = [] 133 | str_1 = r'注册号:' 134 | str_2 = r'名称:' 135 | #正则表达式 136 | # Num = re.compile(str_1 + '(\w{18})', re.S) 137 | # Name = re.compile(str_2 + '(.*?有限公司)', re.S) 138 | Num = re.compile(str_1 + '(\w{18})', re.S) 139 | Name = re.compile('\w{18}' + '(.*?有限公司)', re.S) 140 | #贪婪匹配提取并容错判断 141 | if len(Num.findall(str)) == 0: 142 | result = None 143 | else: 144 | num = Num.findall(str)[0] 145 | if len(Name.findall(str)) == 0: 146 | result = None 147 | else: 148 | name = Name.findall(str)[0] 149 | result.append(num) 150 | result.append(name) 151 | result[1] = result[1].replace('企业名称:', '') 152 | return result 153 | 154 | def py2ex(file, Num_Name, filename): 155 | num = Num_Name[0] 156 | name = Num_Name[1] 157 | file_num = re.compile('\d+', re.S) 158 | i_str = file_num.findall(filename)[0] 159 | i = int(i_str) + 1 160 | data_sheet.write(i, 0, name) 161 | data_sheet.write(i, 1, num) 162 | return file 163 | 164 | #点击全部处理之后,第一个调用此函数 165 | def init(filepath): 166 | global file, data_sheet 167 | # tesseract-ocr功能地址 可能可以删 168 | tesseract_cmd = 'E:/python/Install_tesseract-ocr/Tesseract-OCR/tesseract.exe' 169 | 170 | # 创建表,sheet.write(行, 列, "内容") 171 | file = xlwt.Workbook(encoding='utf-8') 172 | # 创建sheet 173 | data_sheet = file.add_sheet('企业信息') 174 | data_sheet.write(0, 0, "企业名称") 175 | data_sheet.write(0, 1, "企业注册号") 176 | lock = Lock() 177 | #开始识别 178 | for filename in filepath: 179 | # 调用tesseract-ocr识别图片 180 | pic2str = pytesseract.image_to_string(Image.open(filename), lang='chi_sim', config='digits') 181 | 182 | #获取文字信息并提取特征 183 | Information = ''.join(pic2str.split()) 184 | result = NumAndName(Information) 185 | filename = os.path.basename(filename)#E:/fin/1.png 返回 1.png 186 | if result == None: 187 | write_log_to_Text(" " + "【" + filename + "】" + " " + '识别失败') 188 | print(filename + '识别失败') 189 | else: 190 | write_log_to_Text(" " + "【" + filename + "】" + " " + '识别成功') 191 | print(filename + ':' + str(result)) 192 | #输出到excel 193 | py2ex(file, result, filename) 194 | lock.acquire()#互斥锁,只允许同时一个进行 195 | file.save("企业信息.xls") 196 | lock.release() 197 | #GUI界面函数 198 | def main(): 199 | global init_window 200 | init_window = Tk()#实例化出一个父窗口 201 | init_window.title("图片识别工具_v1.0") #窗口名 202 | #1068x681为窗口大小,+130 +10 定义窗口弹出时的默认展示位置 203 | init_window.geometry('1000x481+130+150') 204 | #标签 205 | result_label = Label(init_window, text="选择待处理路径:") 206 | result_label.grid(row=0, column=0) 207 | result_label = Label(init_window, text="日志信息") 208 | result_label.grid(row=1, column=4) 209 | result_label = Label(init_window, text="选择待保存路径:") 210 | result_label.grid(row=4, column=0) 211 | #文本框 212 | global init_Text, result_Text, log_Text, save_Text 213 | 214 | init_Text = Text(init_window, width=28, height=1) #选择打开路径 215 | init_Text.grid(row=0, column=1) 216 | 217 | result_Text = Text(init_window, width=41, height=29) # 选定路径内容展示 218 | result_Text.grid(row=1, column=0, columnspan=2, rowspan=2) 219 | 220 | log_Text = Text(init_window, width=88, height=27) #处理日志展示 221 | log_Text.grid(row=2, column=4) 222 | 223 | save_Text = Text(init_window, width=28, height=1) #选择保存路径,rowspan=1 224 | save_Text.grid(row=4, column=1) 225 | 226 | #按钮 227 | global open_button, all_button, save_button 228 | open_button = Button(init_window, text="选择文件", bg="lightblue", command=openfile) # 调用内部方法 加()为直接调用 229 | open_button.grid(row=0, column=3) 230 | # one_button = Button(init_window, text="单个处理") # 调用内部方法 加()为直接调用 231 | # one_button.grid(row=2, column=4) 232 | all_button = Button(init_window, text="全部识别", bg="lightblue", command=fun) # 调用内部方法 加()为直接调用 233 | all_button.grid(row=2, column=3) 234 | save_button = Button(init_window, text="保存文件", bg="lightblue") # 调用内部方法 加()为直接调用 235 | save_button.grid(row=4, column=3) 236 | #显示全部 237 | init_window.mainloop() 238 | 239 | if __name__ == '__main__': 240 | main() 241 | --------------------------------------------------------------------------------