{"id":17294778,"url":"https://github.com/linsamtw/verification_code_image","last_synced_at":"2025-04-14T11:55:38.154Z","repository":{"id":112933863,"uuid":"103278500","full_name":"linsamtw/Verification_code_image","owner":"linsamtw","description":null,"archived":false,"fork":false,"pushed_at":"2017-09-13T11:56:48.000Z","size":111,"stargazers_count":5,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T11:55:31.714Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linsamtw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-12T14:05:52.000Z","updated_at":"2018-03-04T16:09:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"46e6ee42-705b-4984-b719-c4fd0296dd27","html_url":"https://github.com/linsamtw/Verification_code_image","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsamtw%2FVerification_code_image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsamtw%2FVerification_code_image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsamtw%2FVerification_code_image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linsamtw%2FVerification_code_image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linsamtw","download_url":"https://codeload.github.com/linsamtw/Verification_code_image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248878020,"owners_count":21176242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T11:08:00.531Z","updated_at":"2025-04-14T11:55:38.134Z","avatar_url":"https://github.com/linsamtw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 驗證碼影像處理 ( Verification_code_image )\n\n## 主要是將圖片，灰度化、去雜點、切割，再搭配DL，將有助於提高準確率\n\n首先，下圖是台鐵的驗證碼\u003cbr\u003e\u003cbr\u003e\n ![train](https://github.com/f496328mm/Verification_code_image/blob/master/t3.jpg)\n\n## 讀取圖片 input image \u003cbr\u003e\n```sh\nim = cv2.imread('t3.jpg', cv2.IMREAD_COLOR)\nplt.imshow(im)\n```\n\n## 灰度化( transform gray scale )\u003cbr\u003e\n```sh\nretval, im2 = cv2.threshold(im, 115, 255, cv2.THRESH_BINARY_INV)\nplt.imshow(im2)\n```\n## 刪除雜點( del miscellaneous points ) \u003cbr\u003e\n```sh\nim3 = del_mis_pt_by_threshold(im2)  )\nplt.imshow(im3)\n```\n## 雜點去除後，我們必須對剩下的影像做強化\u003cbr\u003e\n```sh\nim4 = cv2.dilate(im3, (2, 2), iterations=1)\nplt.imshow(im4)\n# save figure\nplt.savefig('del_mix_pt.png')\n```\n 以下是處理完後的 image\u003cbr\u003e\n\u003cimg src=\"https://github.com/f496328mm/Verification_code_image/blob/master/del_mix_pt.png\" width=\"30%\" height=\"30%\"\u003e\n\n## 接下來將分割數字，分割有助於 DL 預測 \u003cbr\u003e\n```sh\nx_split_start,x_split_end = catch_axis_start_and_end(im4,axis='x')\n```\n## 分割方法如下\u003cbr\u003e\n\u003cimg src=\"https://github.com/f496328mm/Verification_code_image/blob/master/del_mix_pt.png\" width=\"30%\" height=\"30%\"\u003e\n用 x 軸去切，只要是\"白色\"，就存入x座標，以上就會得到一串數列，\u003cbr\u003e\n舉例來說，11,12,13...27,63,64...95,129,130...，可以看出來，11~27 是一個數字，63~95 是一個數字，這樣就切出數字了\u003cbr\u003e\n\n\u003cimg src=\"https://github.com/f496328mm/Verification_code_image/blob/master/tem.png\" width=\"30%\" height=\"30%\"\u003e\n\n如上圖之後， y 軸的切法也一樣\n\n## 分割完後的圖片\u003cbr\u003e\n```sh\nimg1 = my_plt_fun(x_split_start,x_split_end,0)\nplt.imshow(img1)\n```\n\u003cimg src=\"https://github.com/f496328mm/Verification_code_image/blob/master/split_image_0.png\" width=\"30%\" height=\"30%\"\u003e\n\u003cimg src=\"https://github.com/f496328mm/Verification_code_image/blob/master/split_image_1.png\" width=\"30%\" height=\"30%\"\u003e\n\u003cimg src=\"https://github.com/f496328mm/Verification_code_image/blob/master/split_image_2.png\" width=\"30%\" height=\"30%\"\u003e\n\u003cimg src=\"https://github.com/f496328mm/Verification_code_image/blob/master/split_image_3.png\" width=\"30%\" height=\"30%\"\u003e\n\u003cimg src=\"https://github.com/f496328mm/Verification_code_image/blob/master/split_image_4.png\" width=\"30%\" height=\"30%\"\u003e\n\n## 儲存\u003cbr\u003e\n```sh\nfor i in range(len(x_split_start)):\n    my_plt_fun(x_split_start,x_split_end,i)\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinsamtw%2Fverification_code_image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinsamtw%2Fverification_code_image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinsamtw%2Fverification_code_image/lists"}