zhongfenglee/IDCardRecognition
zhongfenglee/IDCardRecognition has 1,717 GitHub stars and 383 forks. GitHot measured +1 stars in 24 hours. Last checked 2026-11-07 03:09 UTC. Last push 2017-07-25.
中国大陆第二代身份证识别,自动读出身份证上的信息(姓名、性别、民族、住址、身份证号码)并截取身份证照片
Measured star growth
- in 24h
- +1
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalIDCardRecognition
说明
一个近乎完整的可识别中国身份证信息的Demo
可自动快速读出身份证上的信息(姓名、性别、民族、住址、身份证号码)并截取到身份证图像
原理
经实践发现,只要身份证号码处于摄像头预览图层中时,即不用完全对准身份证也可以读取到身份证号码,但此时截取到的身份证图像并不完整。
为获取到比较完整的身份证图像,经多次实践发现,当身份证人像大约位于拍摄框中的右上区域时,此时可获取到比较完整的身份证图像。
因此,在拍摄框中右上区域加了一个人像区域提示框,并将该区域设为扫描人脸的区域,只有该区域扫描到身份证上的人脸时(确保用户的确将身份证人像对准了拍摄框中的人像框),才执行读取身份证信息的操作。
使用
将该功能集成到你开发的app里:
1、请把Category、Tool、libexidcard、Model、View、Controller这六个文件夹拖入到你的项目里;
2、将idcard_first.png、idcard_first_head.png、idcard_back.png、nav_back.png、nav_torch_on.png、nav_torch_off.png拖入到你的项目中,或在相应代码处替换为你的素材;
3、在你的项目的Info.plist文件中,添加权限描述(Key Value)
Privacy - Camera Usage Description 是否允许访问相机
Privacy - Photo Library Usage Description 是否允许访问相册
4、运行程序,可能会报 ENABLE_BITCODE 错误:

解决方法:

5、在你的项目中的相应处,首先:
#import "IDAuthViewController.h"
在使用该功能的地方:
IDAuthViewController *IDAuthVC = [[IDAuthViewController alloc] init];
[self.navigationController pushViewController:IDAuthVC animated:YES];
6、大功告成,使用真机,Run! 😄
特别鸣谢
本Demo扫描身份证的代码参考自mxl123/IDAndBankCard,非常感谢mxl123的开源,再次表示致谢和敬意!
联系我
如果您觉得本Demo好用,请为我加星,非常感谢,🙏! 如果您有什么疑问/建议,非常欢迎联系我,🙏!
QQ/微信: 852354291 Email: [email protected]
Please Star Me, Follow Me, Thank You!😊
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
560,590 starspublic-apis/public-apis
A collective list of free APIs
496,860 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
439,403 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,100 stars