{"id":29799750,"url":"https://github.com/xiaohange/idcardrecognition","last_synced_at":"2025-07-28T08:11:25.246Z","repository":{"id":295260752,"uuid":"88694599","full_name":"xiaohange/IDCardRecognition","owner":"xiaohange","description":"🇨🇳中国大陆第二代身份证 🆔 识别，自动读出身份证上的信息（姓名、性别、民族、住址、身份证号码）并截取身份证照片, iOS开发者交流:①群:446310206 ②群:426087546  ","archived":false,"fork":false,"pushed_at":"2017-08-18T09:10:46.000Z","size":3970,"stargazers_count":208,"open_issues_count":2,"forks_count":50,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-24T15:03:25.444Z","etag":null,"topics":["distinguished-name","idcard","objective-c","recognition","recognition-color","recognizes-images","swift"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiaohange.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2017-04-19T03:06:35.000Z","updated_at":"2025-05-18T09:17:23.000Z","dependencies_parsed_at":"2025-05-24T15:03:29.938Z","dependency_job_id":"b51d2346-977f-48de-a6c6-8cff3b8454ff","html_url":"https://github.com/xiaohange/IDCardRecognition","commit_stats":null,"previous_names":["xiaohange/idcardrecognition"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xiaohange/IDCardRecognition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohange%2FIDCardRecognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohange%2FIDCardRecognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohange%2FIDCardRecognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohange%2FIDCardRecognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaohange","download_url":"https://codeload.github.com/xiaohange/IDCardRecognition/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohange%2FIDCardRecognition/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267482004,"owners_count":24094508,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["distinguished-name","idcard","objective-c","recognition","recognition-color","recognizes-images","swift"],"created_at":"2025-07-28T08:10:34.896Z","updated_at":"2025-07-28T08:11:25.236Z","avatar_url":"https://github.com/xiaohange.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IDCardRecognition\n\n![](https://github.com/xiaohange/IDCardRecognition/blob/master/timg.jpg?raw=true)\n\n## 简介\n一个近乎完整的可识别中国身份证信息的Demo\n\n可自动快速读出身份证上的信息（姓名、性别、民族、住址、身份证号码）并截取到身份证图像\n\n![IDAuthViewController-开始验证身份证](https://github.com/xiaohange/IDCardRecognition/blob/master/helloDemo.png?raw=true)\n## 实现原理\n经实践发现，只要身份证号码处于摄像头预览图层中时，即不用完全对准身份证也可以读取到身份证号码，但此时截取到的身份证图像并不完整。\n\n为获取到比较完整的身份证图像，经多次实践发现，当身份证人像大约位于拍摄框中的右上区域时，此时可获取到比较完整的身份证图像。\n\n因此，在拍摄框中右上区域加了一个人像区域提示框，并将该区域设为扫描人脸的区域，只有该区域扫描到身份证上的人脸时（确保用户的确将身份证人像对准了拍摄框中的人像框），才执行读取身份证信息的操作。\n## Usage\n将该功能集成到你开发的app里:\n\n```\n1、请把Category、Tool、libexidcard、Model、View、Controller这六个文件夹拖入到你的项目里；\n\n2、将idcard_first.png、idcard_first_head.png、idcard_back.png、nav_back.png、nav_torch_on.png、nav_torch_off.png拖入到你的项目中，或在相应代码处替换为你的素材；\n\n3、在你的项目的Info.plist文件中，添加权限描述（Key   Value）\n\nPrivacy - Camera Usage Description      是否允许访问相机\n\nPrivacy - Photo Library Usage Description       是否允许访问相册\n\n5、在你的项目中的相应处，首先：\n\n`#import \"IDAuthViewController.h\"`\n\n在使用该功能的地方：\n\n`IDAuthViewController *IDAuthVC = [[IDAuthViewController alloc] init];`\n\n`[self.navigationController pushViewController:IDAuthVC animated:YES];`\n \n```\n\n## Star\n\n\u003eiOS开发者交流群：446310206 喜欢就❤️❤️❤️star一下吧！你的支持是我更新的动力！ Love is every every every star! Your support is my renewed motivation!\n\n## License\n\nThis code is distributed under the terms and conditions of the [MIT license](LICENSE). \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaohange%2Fidcardrecognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaohange%2Fidcardrecognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaohange%2Fidcardrecognition/lists"}