如果'\'真能转义1️⃣说1️⃣

如果'\'真能转义1️⃣说1️⃣

打开我们心爱的Android Studio
Android 识别车牌信息-LMLPHP
导入需要的资源

Android 识别车牌信息-LMLPHP
gradle

//开源车牌识别安卓SDK库
    implementation("com.github.HyperInspire:hyperlpr3-android-sdk:1.0.3")
button.setOnClickListener(v -> {
            Log.d("Test", "");
            try (InputStream file = getAssets().open("lp1.jpg")) {
                Bitmap lpImg = BitmapFactory.decodeStream(file);
                Bitmap showImg = null;

                if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                    showImg = Bitmap.createBitmap(lpImg.getWidth(), lpImg.getHeight(), Bitmap.Config.RGB_565, false);
                }

                if (showImg != null) {

                    canvas.setBitmap(showImg);
//                绘制画笔
                    Paint paint = new Paint();
                    paint.setStrokeWidth(2);//设置画笔宽为2
                    paint.setARGB(255, 255, 0, 0);
                    paint.setStyle(Paint.Style.STROKE);
//                绘制画笔到画布上
                    canvas.drawBitmap(lpImg, 0, 0, new Paint());
                    Plate[] plates = HyperLPR3.getInstance().plateRecognition(lpImg, HyperLPR3.CAMERA_ROTATION_0, HyperLPR3.STREAM_BGRA);
//                    自定义字符串内容
                    StringBuilder builder = new StringBuilder();
                    for (int i = 0; i < plates.length; i++) {
                        Plate plate = plates[i];

                        canvas.drawRect(plate.getX1(), plate.getY1(), plate.getX2(), plate.getY2(), paint);

                        builder.append('第').append(i+1).append("车牌").append("\n");
                     builder.append("车牌内容").append(plate.getCode()).append("\n");
                    }
                    img.setImageBitmap(showImg);
                    text.setText(builder.toString());
                }
            } catch (IOException e) {
                Toast.makeText(this, "图像加载失败了", Toast.LENGTH_SHORT).show();
            }
        });

Android 识别车牌信息-LMLPHP

02-09 10:55