文章40 | 阅读 20920 | 点赞0
接口名 | 方法 | 功能描述 |
---|---|---|
IBarcodeDetector | int detect(String barcodeInput, byte[] bitmapOutput, int width, int height); | 根据给定的信息和二维码图片尺寸,生成二维码图片字节流 |
IBarcodeDetector | int release(); | 停止QR码生成服务,释放资源 |
import ohos.ai.cv.common.ConnectionCallback;
import ohos.ai.cv.common.VisionManager;
import ohos.ai.cv.qrcode.IBarcodeDetector;
ConnectionCallback connectionCallback = new ConnectionCallback() {
@Override
public void onServiceConnect() {
// Do something when service connects successfully
}
@Override
public void onServiceDisconnect() {
// Do something when service connects unsuccessfully
}
};
int result = VisionManager.init(context, connectionCallback);
IBarcodeDetector barcodeDetector = VisionManager.getBarcodeDetector(context);
final int SAMPLE_LENGTH = 152;
byte[] byteArray = new byte[SAMPLE_LENGTH * SAMPLE_LENGTH * 4];
int result = barcodeDetector.detect("This is a TestCase of IBarcodeDetector", byteArray, SAMPLE_LENGTH, SAMPLE_LENGTH);
result = barcodeDetector.release();
VisionManager.destroy();
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/Forever_wj/article/details/118310715
内容来源于网络,如有侵权,请联系作者删除!