Giter Site home page Giter Site logo

zhongfenglee / idcardrecognition Goto Github PK

View Code? Open in Web Editor NEW
1.7K 39.0 381.0 7.95 MB

**大陆第二代身份证识别,自动读出身份证上的信息(姓名、性别、民族、住址、身份证号码)并截取身份证照片

Objective-C 89.91% C 10.09%

idcardrecognition's Introduction

IDCardRecognition

说明

一个近乎完整的可识别**身份证信息的Demo

可自动快速读出身份证上的信息(姓名、性别、民族、住址、身份证号码)并截取到身份证图像

IDAuthViewController-开始验证身份证 AVCaptureViewController-拍摄界面 IDInfoViewController-身份证信息界面

原理

经实践发现,只要身份证号码处于摄像头预览图层中时,即不用完全对准身份证也可以读取到身份证号码,但此时截取到的身份证图像并不完整。

为获取到比较完整的身份证图像,经多次实践发现,当身份证人像大约位于拍摄框中的右上区域时,此时可获取到比较完整的身份证图像。

因此,在拍摄框中右上区域加了一个人像区域提示框,并将该区域设为扫描人脸的区域,只有该区域扫描到身份证上的人脸时(确保用户的确将身份证人像对准了拍摄框中的人像框),才执行读取身份证信息的操作。

使用

将该功能集成到你开发的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 错误:

ENABLE_BITCODE Error

解决方法:

ENABLE_BITCODE Error 解决方法

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!😊

idcardrecognition's People

Contributors

zhongfenglee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

idcardrecognition's Issues

初始化失败:ret=-80008

Can not load /var/containers/Bundle/Application/AA1BEDE4-D59D-4DBA-ABDA-42DD8D173E57/******.app/zocr0.lib,控制台始终打印初始化失败:ret=-80008,识别的时候也是打印 ret=[-80002],ret=[-80002],ret=[-80002],ret=[-1]不知道是什么原因

retain cycle

发现LHSIDCardScaningView和里面的NSTimer会Retain Cycle, 导致Memory Leak,能否修复下?

好奇

图像识别一向是高端的技术,你这里我没有看到具体的实现方法,是不是讲第三方的图像识别封装起来了,只是简单的加点界面之类的

横竖屏切换崩溃

利用AVCaptureConnection,设置了横屏状态下的videoConnection.videoOrientation = AVCaptureVideoOrientationLandscapeRight,横竖屏切换N次之后会崩溃

could not load any Objective-C class information. This will significantly reduce the quality of type information available.

  • thread #9: tid = 0x4ddfe5, 0x251461dc libsystem_platform.dylib_platform_memmove$VARIANT$CortexA9 + 160, queue = 'com.apple.avfoundation.videodataoutput.bufferqueue', stop reason = EXC_BAD_ACCESS (code=1, address=0x8380000) frame #0: 0x251461dc libsystem_platform.dylib_platform_memmove$VARIANT$CortexA9 + 160
    • frame #1: 0x0033ba9c WorkerPortalgrBitmapCopyTo(pSrcImg=0x1f31c594, pDstImg=0x176b19d0) + 180 at grbitmap.c:566 [opt] frame #2: 0x0033be6c WorkerPortalgrBitmapClone(pstBitmap=0x1f31c594) + 56 at grbitmap.c:782 [opt]
      frame #3: 0x00337ffe WorkerPortalEXIDCardReco1(pstImage=0x1f31c594, pstIDCard=0x1f31c2b8) + 230 at exidcard.c:109 [opt] frame #4: 0x00339f88 WorkerPortalEXIDCardReco2(pstImage=, szResBuf="\xaf1", nResBufSize=1024) + 56 at exidcard.c:395 [opt]
      frame #5: 0x0033fb54 WorkerPortalEXCARDS_RecoIDCardData(pbImage=<unavailable>, nWidth=<unavailable>, nHeight=<unavailable>, nPitch=<unavailable>, nBitCount=<unavailable>, szResBuf=<unavailable>, nResBufSize=<unavailable>) + 116 at excards.c:107 [opt] frame #6: 0x000cbdf4 WorkerPortal-[Capture idCardRecognit:](self=0x17783cc0, _cmd="idCardRecognit:", sampleBuffer=0x1751e190) + 328 at Capture.m:314
      frame #7: 0x000cba60 WorkerPortal`-[Capture captureOutput:didOutputSampleBuffer:fromConnection:](self=0x17783cc0, _cmd="captureOutput:didOutputSampleBuffer:fromConnection:",

导入报错

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.

大佬您好获取时间

这个能读取出来身份证号码、名字、民族、地址、性别。。。那么出生时间呢??

在iPad上使用成像不正确

在iPad上使用的时候成像不完整,比如识别的时候身份证比较靠下,这个时候往上移动才会出现,就是像是反的,而是也识别不出来,不知道怎么回事

Xcode12

The linked library 'libexidcardiosX_86.a' is missing one or more architectures required by this target: arm64.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.