mCardDetector = new CardDetector(mContext);
Frame frame = new Frame();
frame.setBitmap(mBitmap);
CardConfiguration config = new CardConfiguration();
config.setEngineType(TextDetectType.TYPE_TEXT_DETECT_CARD);
mCardDetector.setCardConfiguration(config);
JSONObject jsonObject = mCardDetector.detect(frame, null);
Passport result = (Passport)mCardDetector.convertResult(jsonObject);
{
"resultCode": 0,
"common_text ": {
"name": "王元",
"pinyin": "wang,yuan",
"id": "G66666666",
"birthDate": "19830415",
"sex": "男",
"validDate": "20210126"
}
}
可以的,在faceCompare()方法中会默认启动引擎,如果引擎已经启动则不会再次启动,开发者可以放心使用。
护照识别为端侧能力,照片和相关数据均不会上传至网络,隐私安全有保障。
卡证API为端侧能力,在无网络连接的环境下仍可正常使用。
release()方法会卸载在NPU芯片中已经加载的模型,请在应用不再使用护照识别时及时卸载模型,释放资源。