Giter VIP home page Giter VIP logo

idnumdetect's Introduction

idNumDetect

身份证号码识别

学习opencv后的一个总结,用opencv进行特征提取,初次接触了机器学习,使用了机器学习最简单的k邻近算法进行号码识别。

想法是,因为身份证号码是身份证上最长的数字,并且数字间隔是一样的,所以可以考虑使用霍夫概率变换进行最长有间隔直线匹配。尝试了三种方法进行特征提取, 一开始尝试了使用harris角点检测,确定身份证位置,后来发现这一步骤实属多余直接Pass掉了,

第二次尝试了Canny算子提取图像轮廓再使用霍夫变换,但是提取的轮廓过多,并且身份证是矩形,严重影响了霍夫变换检测直线最后Pass,

最后使用了MSER提取特征区域,可以检测出需要的特征区域,再通过染色方式得到特征区域的轮廓二值图完美提取身份证号码特征区域。当然由于身份证并不定是正放,所以根据直线的角度和旋转矩阵解决了30°角以内的斜放身份证(后期会改进并增加角度)。

得到特征区域后就是识别了,采用了opencv自带的Knn算法,数据集为自己通过opencv得到的0-9十个数字的30°角以内的旋转图像(其实做了360°,但是多余的数据不怎么需要) 将截取的数据集使用knn训练并且识别,成功率在93以上。不过缺点还是有的,比如光线遮挡问题,不过使用了自适应阈值化可以一定程度上解决。只测试了30张身份证的图片,当旋转角度过高的时候出现了一次识别错误,其余均正确。

改进路线:实时识别,通过调用摄像头进行实时识别

idnumdetect's People

Contributors

ifdealer avatar

Forkers

dingjingmaster

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.