{ "info": { "author": "aboutmydreams", "author_email": "aboutmydreams@163.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "![all](img/all.png)\n\n# \u4ec0\u4e48\u662f pycapt\n\n[GitHub \u6b22\u8fce\u63d0 pr\uff0c\u5982\u679c\u6709bug\u6216\u65b0\u9700\u6c42 \u8bf7\u53cd\u9988 issue]()\n\npycapt \u662f\u6211\u5728\u5904\u7406\u9a8c\u8bc1\u7801\u65f6\u7f16\u5199\u7684\u4e00\u7cfb\u5217\u56fe\u50cf\u5904\u7406\u7684\u7b97\u6cd5\u5305\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u4e3a\u56fe\u50cf\u53bb\u566a\u70b9\u3001\u5e72\u6270\u7ebf \u4ee5\u53ca\u5206\u5272\u9a8c\u8bc1\u7801\uff0cpycapt \u5c01\u88c5\u4e86\u4e00\u4e9b\u5173\u4e8e\u56fe\u5f62\u77e9\u9635\u7684\u65b9\u6cd5\uff0c\u4f8b\u5982\u5c06\u56fe\u7247\u5206\u5272\u4e3a\u6807\u51c6\u5316\u7684\u77e9\u9635\u3001\u751f\u6210\u60a8\u6240\u9700\u8981\u7684\u8bad\u7ec3\u96c6\u56fe\u7247\u7b49\uff0c\u6709\u52a9\u4e8e\u60a8\u4f7f\u7528\u6df1\u5ea6\u5b66\u4e60\u6765\u8fdb\u884c\u56fe\u50cf\u8bc6\u522b\u3002\n\npycapt \u5305\u62ec\u5904\u7406\u9a8c\u8bc1\u7801\u548c\u751f\u6210\u9a8c\u8bc1\u7801\u4e24\u90e8\u5206\uff0c\u591a\u8c22\u6211\u7684\u597d\u53cb [exqlnet]() [ZhouYingSASA]() \u7684\u5171\u540c\u5e2e\u52a9 \u53d1\u5e03 pycapt 1.0.1\n\n### \u4f9d\u8d56\u4e0e\u5b89\u88c5\n\n```bash\nPillow\nnumpy\n```\n\n```py\npip3 install pycapt\n```\n\n### \u76ee\u5f55\u7ed3\u6784\n\n![frcc0](img/files.png)\n\n## \u4f7f\u7528 pycapt \u8fdb\u884c\u9a8c\u8bc1\u7801\u56fe\u50cf\u5904\u7406\n\n### \u5bfc\u5165\n\n```py\nimport pycapt\nfrom PIL import Image\n```\n\n\n\n### \u56fe\u50cf\u4e8c\u503c\u5316\n\n**two_valve : \u4e8c\u503c\u5316\u65b9\u6cd5\uff0c\u5fc5\u9009\u53c2\u6570img\u4e3a\u56fe\u7247\uff0c\u53ef\u9009\u53c2\u6570 Threshold** \u662f\u7070\u5ea6\u9600\u503c\uff0c\u8fd9\u91cc\u53ef\u4ee5\u9009\u62e9\u9002\u5408\u7684\u503c\uff0c\u9ed8\u8ba4\u503c\u662f100 . **\u8fd4\u56de\u65b0\u5904\u7406\u8fc7\u7684\u56fe\u7247**\n\n```py\nimg = Image.open('./img/frcc0.png')\nimg = pycapt.two_value(img,Threshold=100)\nimg.show()\n```\n\n\n\n![frcc0](img/frcc0.png)\n\n![frcc1](img/frcc1.png)\n\n### \u5904\u7406\u566a\u70b9\n\n**dele_noise \uff1a\u6d88\u9664\u566a\u70b9\u65b9\u6cd5\uff0c\u8be5\u65b9\u6cd5\u4f7f\u7528\u7684\u662f\u516b\u9886\u57df\u53bb\u566a\u70b9\u6cd5\uff0cN\u662f\u9886\u57df\u5f02\u70b9\u4e2a\u6570\uff0cZ\u662f\u5904\u7406\u6b21\u6570\uff0c\u5904\u7406\u6b21\u6570\u8d8a\u591a \u56fe\u5f62\u8d8a\u5706\u6ed1**\u3002\n\n```py\nimg = pycapt.dele_noise(img,N=5,Z=2)\nimg.show()\n```\n\n\n\n![frcc2](img/frcc2.png)\n\n### \u5904\u7406\u5e72\u6270\u7ebf\n\n**dele_line : \u53bb\u9664\u5e72\u6270\u7ebf\uff0c\u5220\u9664\u8fde\u7eed\u7684N\u4e2a\u7ad6\u76f4\u50cf\u7d20\u3002\u914d\u5408dele_noise\u65b9\u6cd5\u4f7f\u7528\u6548\u679c\u66f4\u4f73\u3002**\n\n```py\nimg = pycapt.dele_line(img,N=4)\nimg.show()\n```\n\n**\u914d\u5408dele_noise\u65b9\u6cd5\u4f7f\u7528\u6548\u679c\u66f4\u4f73\u3002**\n\n```py\nimg = pycapt.dele_line(img,4)\nimg = pycapt.dele_noise(img,N=4,Z=2)\nimg = pycapt.dele_line(img,3)\nimg = pycapt.dele_noise(img,N=4,Z=2)\nimg = pycapt.dele_line(img,3)\nimg = pycapt.dele_line(img,2)\nimg = pycapt.dele_line(img,1)\nimg.show()\n```\n\n![frcc2](img/frcc3.png)\n\n**\u60f3\u8981\u66f4\u597d\u7684\u6548\u679c\uff0c\u4f60\u8fd8\u53ef\u4ee5\u5148\u4f7f\u7528\u8f6c\u7f6e\u56fe\u7247\u7684 tran_90(img) \u65b9\u6cd5 \u518d\u6b21\u4f7f\u7528\u53bb\u9664\u5e72\u6270\u7ebf\u7684\u65b9\u6cd5\uff0c\u6700\u540e\u518d\u8f6c\u7f6e\u56de\u6765**\n\n```py\nimg = pycapt.tran_90(img)\nimg.show()\nimg = pycapt.dele_line(img,3)\nimg = pycapt.dele_line(img,2)\nimg = pycapt.dele_line(img,1)\nimg = pycapt.tran_90(img)\nimg.show()\n```\n\n![frcc2](img/frcc4.png)\n\n### \u659c\u4f53\u77eb\u6b63\n\n**\u659c\u4f53\u77eb\u6b63\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5206\u5272\u4e0e\u8bc6\u522b\u3002**\u539f\u7406\u662f\u5e73\u79fb\uff0c\u5c06\u6bcf\u4e00\u884c\u5411\u5de6\u6216\u5411\u53f3\u5e73\u79fb\u4e0d\u540c\u8ddd\u79bb\uff0c\u6700\u540e\u5f62\u6210\u77eb\u6b63\u7684\u6548\u679c\u3002pans\u5c31\u662f\u77eb\u6b63\u5217\u8868\uff0c\u6b63\u5de6\u8d1f\u53f3\u5e73\u79fb\u3002pans\u5217\u8868\u7684\u5143\u7d20\u4e2a\u6570\u9700\u8981\u662f\u56fe\u7247\u7684\u9ad8\u5ea6\uff0c\u4f8b\u5b50\u4e2d\u56fe\u7247 height \u662f40.\n\n**rectify_img(img,pans) \u8fd4\u56de\u65b0\u7684\u56fe\u7247\u3002**\n\n```py\npan = [18, 18, 18, 18, 17, 17, 17,\\\n 16, 16, 16, 15, 15, 15, 15, 14,\\\n 14, 14, 14, 13, 13, 10, 10,\\\n 10, 9, 9, 8, 7, 6, 5, 5, 4, \\\n 4, 4, 4, 4, 3, 1, 0, 0, 0]\nimg = pycapt.rectify_img(img,pans=pan)\nimg.show()\n```\n\n![frcc2](img/frcc5.png)\n\n\u5982\u679c\u4f60\u89c9\u5f97\u592a\u96be\u770b\u4e86\uff0c\u53ef\u4ee5\u63d0\u524d\u4f7f\u7528\u77eb\u6b63\u518d\u4f7f\u7528 dele_line \u548c dele_noise, \u5f53\u7136\u4ea1\u7f8a\u8865\u7262\u4e5f\u4e0d\u592a\u574f\u3002\n\n```py\nimg = pycapt.rectify_img(img,pans=pan)\nimg = pycapt.dele_line(img,3)\nimg = pycapt.dele_line(img,2)\nimg = pycapt.dele_line(img,1)\nimg.show()\n```\n\n![frcc2](img/frcc6.png)\n\n\n\n### \u56fe\u5f62\u5206\u5272\n\n**cut_img_to_img_list** \u8bbe\u7f6e\u5355\u4e2a\u56fe\u7247\u5408\u9002\u957f\u5ea6\u540e\u5207\u5272\uff0c\u8fd4\u56de\u8be5\u957f\u5ea6\u7684\u5207\u5272\u56fe\u7247\uff0c\u8be5\u957f\u5ea6\u53ef\u4ee5\u8bbe\u7f6e\u7684\u6bd4\u8f83\u5927\uff0c\u8be5\u65b9\u6cd5\u4f1a\u5728\u5207\u5272\u56fe\u7247\u7684\u4e24\u8fb9\u8865\u767d\u3002\u4f60\u53ef\u4ee5\u5c06\u8fd9\u4f5c\u4e3a\u4e00\u79cd\u6807\u51c6\u5316\u56fe\u7247\u7684\u65b9\u6cd5\u3002\n\n```py\nimg = Image.open('1.png')\nimg_list = pycapt.cut_img_to_img_list(img,max_width=30,background=255)\nfor i in img_list:\n i.show()\n```\n\n![frcc2](img/last.png)\n\n\u5f53\u4f60\u4f7f\u7528**\u6df1\u5ea6\u5b66\u4e60**\u65f6\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 **cut_img_to_mode_list(image,max_width) **\u6765\u83b7\u5f97\u6807\u51c6\u5316\u7684\u6570\u7ec4\u3002\n\n### \u56fe\u7247\u88c1\u526a\n\n\u5f53\u4f60\u7684\u56fe\u7247 height \u53ef\u4ee5\u538b\u7f29\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528 **small_img(img,box)** \u6765\u88c1\u526a\u56fe\u7247\uff0c\u8fd9\u6837\u53ef\u4ee5\u51cf\u5c11\u4e4b\u540e\u5b66\u4e60\u7684\u8ba1\u7b97\u91cf\u3002\n\n\u4f8b\u5982\n\n## \u4f7f\u7528 pycapt \u751f\u6210\u9a8c\u8bc1\u7801\u8bad\u7ec3\u96c6\n\n### do_captcha \u751f\u6210\u9a8c\u8bc1\u7801\u8bad\u7ec3\u96c6\n\nwidth \u9a8c\u8bc1\u7801\u56fe\u7247\u957f\u5ea6\uff0cheight \u9a8c\u8bc1\u7801\u9ad8\u5ea6\uff0cnum_of_str \u9a8c\u8bc1\u7801\u4e0a\u5b57\u7b26\u6570\u91cf \u9ed8\u8ba44\uff0cfont \u5b57\u4f53\u5927\u5c0f \u9ed8\u8ba430\uff0cgray_value \u7070\u5ea6\u503c \u9ed8\u8ba4255\uff0cfont_family \u5b57\u4f53\u6587\u4ef6\uff0c\u5728\u8fd9\u91cc\u53ef\u4ee5\u9009\u62e9\u4f60\u9700\u8981\u7684\u7c97\u7ec6\uff0c\u6837\u5f0f\u7b49\uff0c\u4f46\u524d\u63d0\u662f\u4f60\u7535\u8111\u4e0a\u6709\u8fd9\u79cd\u5b57\u4f53\u3002\n\n\u5982\u679c\u4f60\u4e0d\u77e5\u9053\u81ea\u5df1\u7535\u8111\u6709\u54ea\u4e9b\u5b57\u4f53\uff0c\u8bf7\u70b9\u51fb [**\u8fd9\u91cc**]() \u3002\n\n```py\nname,img = pycapt.do_captcha(\n my_str_list=['A','B','C','D','1','2','3'],\n width=160,\n height=40,\n num_of_str=4,\n font=30,\n gray_value=255,\n font_family='\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W8.ttc')\n\nprint(name)\nimg.show()\n\n# output\uff1a ['C', 'D', '2', 'A']\n```\n\n![frcc2](img/do.png)\n\n### \u589e\u52a0\u566a\u70b9\n\n**more_noise \uff1aN\u662f\u52a0\u566a\u7387\uff0c0 < N < 1\uff0cZ\u4e3a\u5904\u7406\u6b21\u6570**\n\n```py\nimg = pycapt.more_noise(img,N=0.5,Z=2)\n```\n\n![frcc2](img/do1.png)\n\n### \u504f\u79fb\n\n```py\nimg = pycapt.img_pan(img,10,3)\n```\n\n![frcc2](img/do2.png)\n\n### \u503e\u659c\n\n**\u8fd8\u662f\u548c\u4e4b\u524d\u4e00\u6837 \u4f7f\u7528 rectify_img** \n\n```py\npan = [18, 18, 18, 18, 17, 17, 17,\\\n 16, 16, 16, 15, 15, 15, 15, 14,\\\n 14, 14, 14, 13, 13, 10, 10,\\\n 10, 9, 9, 8, 7, 6, 5, 5, 4, \\\n 4, 4, 4, 4, 3, 1, 0, 0, 0]\nimg = pycapt.rectify_img(img,pans=pan)\n```\n\n![frcc2](img/do3.png)\n\n### \u52a0\u53bb\u566a\u70b9 \u53d8\u5e73\u6ed1\n\n**clear_train_img \u76f8\u5f53\u4e8e dele_line(line,N) \u5206\u522b\u5bf9line\u6d88\u9664\u4e86N=4\uff0c3\uff0c2\uff0c1 \u76844\u6b21\u566a\u70b9\uff0c\u4e5f\u5c31\u76f8\u5f53\u4e8e\u7eb5\u5411\u53d8\u5e73\u6ed1\u4e86**\n\n```py\nimg = pycapt.show_noise_img(img,0.1,1)\nimg = pycapt.dele_noise(img,5,2)\nimg = pycapt.clear_train_img(img)\n```\n\n![frcc2](img/do4.png)\n\n\u8fd9\u91cc \u4f60\u5b8c\u5168\u53ef\u4ee5\u4f7f\u7528pycapt\u751f\u6210\u6df1\u5ea6\u5b66\u4e60\u9a8c\u8bc1\u7801\u7684\u8bad\u7ec3\u96c6\u4e86\u3002\n\n\u90a3\u5982\u679c\u60f3\u8981\u66f4\u65b9\u4fbf\u70b9\u5462\uff1f \u8bf7\u770b\u8fd9\u91cc\u3002\n\n### \u76f4\u63a5\u751f\u6210\u8bad\u7ec3\u96c6\u7684\u65b9\u6cd5\n\ntrain_img \u8fd4\u56de\u8bad\u7ec3\u96c6\u56fe\u7247\uff0cmy_str_list\uff0c\u4f60\u7684\u5b57\u7b26\u96c6\u5217\u8868\uff0cwidth height \u957f\u5ea6\u9ad8\u5ea6\uff0cnum_of_str \u663e\u793a\u5728\u9a8c\u8bc1\u7801\u56fe\u7247\u4e0a\u7684\u5b57\u7b26\u4e32\u4e2a\u6570\uff0c\u4f1a\u4ece\u4f60\u7684 my_str_list \u4e2d\u968f\u673a\u6311\u9009\uff0cfont \u663e\u793a\u7684\u5b57\u4f53\u5927\u5c0f\uff0cxpan ypan \u5de6\u53f3\u4e0e\u4e0a\u4e0b\u968f\u673a\u504f\u79fb\u5c3a\u5bf8\uff0crotate \u5b57\u7b26\u968f\u673a\u65cb\u8f6c\u5c3a\u5ea6\uff0cnoise_N \u52a0\u566a\u7387\uff080 < N < 1\uff09\uff0cnoise_Z \u52a0\u566a\u6b21\u6570\uff0cgray_value \u80cc\u666f\u7070\u5ea6\uff0c\u9ed8\u8ba4\u767d\u8272\uff0cfont_family \u5b57\u4f53\u6837\u5f0f\uff0c\u5982\u679c\u4f60\u4e0d\u77e5\u9053\u81ea\u5df1\u7535\u8111\u6709\u54ea\u4e9b\u5b57\u4f53\uff0c\u8bf7\u70b9\u51fb [**\u8fd9\u91cc**]() \u3002\n\n```py\nfilename,img = pycapt.train_img(\n my_str_list=['A','B','C','D','E'],\n width=30,\n height=32,\n num_of_str=1,\n font=30,\n xpan=3,\n ypan=2,\n rotate=15,\n noise_N=0.3,\n noise_Z=2,\n gray_value=255,\n font_family='\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W8.ttc')\n```\n\n\u53ea\u8981\u4f60\u518d\u5199\u4e00\u4e2a\u5faa\u73af\uff0c**img.save('train_img/{}.png'.format(file_name))** \u5c31\u53ef\u4ee5\u751f\u6210\u6210\u5343\u4e0a\u4e07\u5f20\u8bad\u7ec3\u96c6\u56fe\u7247 \u83b7\u53d6\u6807\u7b7e\u53ea\u9700\u8981 name = file_name[0] \u5c31\u53ef\u4ee5\u60f9\u3002\n\n![frcc2](img/train.png)\n\n## Last\n\n\u7406\u8bba\u4e0a\u53ea\u8981\u4f60\u4f7f\u7528 pycapt \u5904\u7406\u56fe\u7247\uff0c\u8c03\u7528\u5404\u65b9\u6cd5\uff0c\u5e76\u4f7f\u7528 train_img \u65b9\u6cd5 ,\u7406\u8bba\u4e0a\u53ef\u4ee5\u89e3\u51b390%\u9a8c\u8bc1\u7801\u5904\u7406\u548c\u6a21\u62df\u751f\u6210\u95ee\u9898\uff0c\u6b22\u8fce star pr \u548c\u63d0issue\uff0c\u5982\u679c\u4f60\u60f3\u66f4\u4e86\u89e3\u5176\u4e2d\u7684\u539f\u7406\uff0c\u70b9\u51fb[\u8fd9\u91cc](https://www.yuque.com/zhiwa/deepin/og0te8)\uff0c\u671f\u671b\u542c\u89c1\u4f60\u7684\u60f3\u6cd5\u6216pr\u3002\n\n### \u6350\u8d60\n\n\u5982\u679c\u6709\u6240\u5e2e\u52a9 [\u8bf7\u6211\u559d\u4e00\u7897\u8336](https://www.yuque.com/zhiwa/deepin/hwnhg0)~\n\n![pay](img/pay.png)\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/aboutmydreams/pycapt", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pycapt", "package_url": "https://pypi.org/project/pycapt/", "platform": "", "project_url": "https://pypi.org/project/pycapt/", "project_urls": { "Homepage": "https://github.com/aboutmydreams/pycapt" }, "release_url": "https://pypi.org/project/pycapt/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "a library that processes verification codes", "version": "1.0.3" }, "last_serial": 5041789, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "86cccd05557f24aa35eca2554243059f", "sha256": "9893f278229d5dc00a2fd8a9ce7ad5b251b18b298f93d8095eacf04fa810e4ef" }, "downloads": -1, "filename": "pycapt-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "86cccd05557f24aa35eca2554243059f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14168, "upload_time": "2019-03-30T14:31:53", "url": "https://files.pythonhosted.org/packages/ca/54/66aa8ec4d0809ee9271e40455fcad219e08f9a523212c1fc44720197047b/pycapt-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5eb45f9967e3ba656d8a75277c7d5d70", "sha256": "54b4c9913253b953ab6a0a98c5e8276d6cd42b1a1838ee89aab086ef851d5fa2" }, "downloads": -1, "filename": "pycapt-0.1.1.tar.gz", "has_sig": false, "md5_digest": "5eb45f9967e3ba656d8a75277c7d5d70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7602, "upload_time": "2019-03-30T14:31:56", "url": "https://files.pythonhosted.org/packages/ba/14/91bd8199d335c44fe225c044427acfca9d5b60d8df25404a595f65e7ee1b/pycapt-0.1.1.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "d4b6bca4c67b30fe15738c453ab8c243", "sha256": "ccfbe73b792093fa28a2cfd5a33f11642886ec0836d846dc40831a5a9d6443c6" }, "downloads": -1, "filename": "pycapt-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "d4b6bca4c67b30fe15738c453ab8c243", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17708, "upload_time": "2019-04-02T02:54:43", "url": "https://files.pythonhosted.org/packages/4e/02/1122b7db26e697b4302c1487f09cd7c65e2d78a2d9d5c7d52f5a860eb08c/pycapt-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "75b42c30aa43ab9d12499b3a101476ff", "sha256": "98629a9bc1125355e5251998361a3c1b76c7ff21c0093a27725747e618a04946" }, "downloads": -1, "filename": "pycapt-1.0.3.tar.gz", "has_sig": false, "md5_digest": "75b42c30aa43ab9d12499b3a101476ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11129, "upload_time": "2019-04-02T02:54:45", "url": "https://files.pythonhosted.org/packages/e9/db/4a98da33e42e5c4b5fb30bbf8557809621d5c7c82249daafae86127188da/pycapt-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d4b6bca4c67b30fe15738c453ab8c243", "sha256": "ccfbe73b792093fa28a2cfd5a33f11642886ec0836d846dc40831a5a9d6443c6" }, "downloads": -1, "filename": "pycapt-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "d4b6bca4c67b30fe15738c453ab8c243", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17708, "upload_time": "2019-04-02T02:54:43", "url": "https://files.pythonhosted.org/packages/4e/02/1122b7db26e697b4302c1487f09cd7c65e2d78a2d9d5c7d52f5a860eb08c/pycapt-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "75b42c30aa43ab9d12499b3a101476ff", "sha256": "98629a9bc1125355e5251998361a3c1b76c7ff21c0093a27725747e618a04946" }, "downloads": -1, "filename": "pycapt-1.0.3.tar.gz", "has_sig": false, "md5_digest": "75b42c30aa43ab9d12499b3a101476ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11129, "upload_time": "2019-04-02T02:54:45", "url": "https://files.pythonhosted.org/packages/e9/db/4a98da33e42e5c4b5fb30bbf8557809621d5c7c82249daafae86127188da/pycapt-1.0.3.tar.gz" } ] }