TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | Apache 2 |
ReleasedLast Release | Aug 2016 |
SPMSupports SPM | ✗ |
Maintained by Kevin.Gong.
ChineseIDCardOCR是一个用swift写的framework,用来识别中国二代身份证信息。修改自 Swift-ORC。
import ChineseIDCardOCR
let vc = ScannerViewController()
vc.didRecognizedHandler = { idcard in
debugPrint(idcard)
}
presentViewController(vc, animated: true, completion: nil)
import ChineseIDCardOCR
let ocrInstance = IDCardOCR()
let idCardImage = UIImage ... ...
ocrInstance.recognize { recoginzedResult in
debugPrint(recoginzedResult)
}
ChineseIDCardOCR 会对传入的UIImage进行人脸检测,根据监测到的frame和身份证比例,计算出身份证号码所在在的 Rect,然后截取图片。获取身份证号码图片以后, 利用GPUImage对图片进行一系列预处理,根据 Connected-component labeling理论,把身份证号码图片剪切成18个单独的小图片。然后利用前馈神经网络(FFNN)对每个图片进行识别。
在framework提供了OCR-Training.swift可以根据自己的特点提供单独的训练数据
The code in this repository is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
NOTE: This software depends on other packages that may be licensed under different open source licenses.