BIGPPWONG / idcardocr

离线环境下第二代居民身份证信息识别
GNU General Public License v3.0
411 stars 149 forks source link

最终的返回结果不包含身份证末位的'X' #11

Closed lewisxiao closed 5 years ago

lewisxiao commented 5 years ago

图片 testimages/15.jpg 中的身份证号末位含有一个X符号,但在程序的最终返回结果(中间的打印结果是有X符号的)并没有包含这个X符号。我调试时,发现应该是idcardocr.py中的prunc_filter方法的正则表达式,没有把X符号考虑进去,如图。 image

下面是我的测试代码:

import idcard_recognize;
print(idcard_recognize.process('testimages/15.jpg'));

下面是输出:

0.3333333333333333 1280
进入身份证模版匹配流程...
查找身份证耗时:1553
进入身份证光学识别流程...
name
姜璐
sex

nation

address
辽宁省大连市甘井子区海
茂路807号1-4一4
idnum
21021119821218141X --  这里是有X符号的
{'sex': '', 'name': '姜璐', 'error': 0, 'nation': '', 'birth': '19821218', 'address': '辽宁省大连市甘井子区海茂路807号14一4', 'idnum': '21021119821218141'} -- 这里X符号就不见了
lewisxiao commented 5 years ago

另外问一下,这个prunc_filter方法的作用是什么?

传入的字符串已经是识别之后的结果了,为什么还再用正则表达式去过滤一遍?

staugur commented 5 years ago

同疑问

BIGPPWONG commented 5 years ago

感觉反馈,已排除英文字母过滤,这个方法是用来过滤ocr结果中的标点符号

hughwang-me commented 5 years ago

目前的 docker 镜像好像 还是无法识别身份证号码中的X