BarcodeDetector detector = new BarcodeDetector(getApplicationContext());
Frame frame = new Frame();
frame.setBitmap(bitmap);
JSONObject jsonObject = detector.detect(frame,null);
{
"resultCode": 0,
"barcode": "[{\"contentTypes\":[11],
\
"iSBN\":{\"isbn\":\"9787540746445\"}}]"
}
可以的,在faceCompare()方法中会默认启动引擎,如果引擎已经启动则不会再次启动,开发者可以放心使用。
release()方法会卸载在NPU芯片中已经加载的模型,请在应用不再使用码检测时及时卸载模型,释放资源。