PapilonIDRecognitioniOS
示例
要运行示例项目,请克隆仓库,然后从 Example 目录中首先运行 pod install
。
要求
- iOS 13+
安装
PapilonIDRecognitioniOS可以通过CocoaPods获取。要安装,只需将以下行添加到您的Podfile中
pod 'PapilonIDRecognitioniOS', '1.0.0'
设置PapilonIDRecognitioniOS
您需要许可证令牌才能运行此SDK。请联系Papilon Savunma或发送电子邮件至[email protected]
使用方法
只需创建一个具有类名IDRecognizer
的对象,并带有初始化参数idType
、token
和licenceID
。"token"和"licenceID"将由Papilon Savunma提供。
重要: 您获得的token仅属于您,您不得丢失它。如果token或包出现问题,请联系Papilon Savunma并提供您获得的licenceID
。
本包具有多个国家身份证、护照和驾照的ID识别功能。以下是ID识别选项
参数 | 类型 | 值 | 描述 |
---|---|---|---|
idType |
字符串 |
586_nic_id_front |
PK NIC ID Front |
idType |
字符串 |
586_nicop_id_front |
PK NICOP ID Front |
func captureOutput(
_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer,
from connection: AVCaptureConnection
) {
// Ensure we can retrieve an image from the provided sample buffer.
guard let frame = CMSampleBufferGetImageBuffer(sampleBuffer) else {
debugPrint("Unable to get image from sample buffer")
return
}
// If the idRecognizer instance has not been created yet (i.e., it's nil),
// we initialize it. This will only run once due to the nature of optional values.
if idRecognizer == nil {
idRecognizer = IDRecognizer(
idType: "###ID_TYPE###",
token: "###TOKEN_TAKEN_FROM_PAPILON###",
licenceID: "###LICENCE_ID_TAKEN_FROM_PAPILON###"
) {
// This closure is called after the IDRecognizer initialization.
// Add any additional setup or tasks you wish to perform once after
// IDRecognizer is initialized.
}
}
// Using the initialized idRecognizer instance, we call the detectIDDocument function.
if let results = idRecognizer?.detectIDDocument(in: frame) {
print("======== RESULTS ========")
for (key, value) in results {
print("\(key): \(value)")
}
print("======== RESULTS ========")
}
}
许可
有关更多信息,请参阅LICENSE文件。