Update Android Demo
This commit is contained in:
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.hyperai.hyperlpr_sdk_demo;
|
||||
package com.hyperai.example.lpr3_demo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -21,6 +21,6 @@ public class ExampleInstrumentedTest {
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.hyperai.hyperlpr_sdk_demo", appContext.getPackageName());
|
||||
assertEquals("com.hyperai.example.lpr3_demo", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.hyperai.hyperlpr_sdk_demo">
|
||||
package="com.hyperai.example.lpr3_demo">
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
@@ -38,7 +38,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.HyperLPR_SDK_Demo">
|
||||
android:theme="@style/Theme.HyperLPR3Example">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
@@ -49,11 +49,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".CameraActivity" />
|
||||
<!-- <activity-->
|
||||
<!-- android:name=".CameraPlate"-->
|
||||
<!-- android:screenOrientation="landscape"-->
|
||||
<!-- >-->
|
||||
<!-- </activity>-->
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
+2
-11
@@ -1,18 +1,14 @@
|
||||
package com.hyperai.hyperlpr_sdk_demo;
|
||||
package com.hyperai.example.lpr3_demo;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
import com.hyperai.hyperlpr3.HyperLPR3;
|
||||
import com.hyperai.hyperlpr3.bean.Plate;
|
||||
|
||||
@@ -20,9 +16,6 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author by hs-johnny
|
||||
@@ -33,7 +26,6 @@ public class CameraActivity extends Activity {
|
||||
FrameLayout previewFl;
|
||||
CameraPreviews cameraPreview;
|
||||
TextView plateTv;
|
||||
// TextView regTv;
|
||||
ImageView image;
|
||||
|
||||
@Override
|
||||
@@ -98,7 +90,6 @@ public class CameraActivity extends Activity {
|
||||
plateTv.setText(showText);
|
||||
|
||||
}
|
||||
|
||||
// stopPreview();
|
||||
}
|
||||
|
||||
}
|
||||
+4
-11
@@ -1,11 +1,10 @@
|
||||
package com.hyperai.hyperlpr_sdk_demo;
|
||||
package com.hyperai.example.lpr3_demo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
import android.hardware.Camera;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
//import android.support.v4.content.ContextCompat;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.MotionEvent;
|
||||
@@ -14,16 +13,15 @@ import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.hyperai.hyperlpr3.HyperLPR3;
|
||||
import com.hyperai.hyperlpr3.bean.HyperLPRParameter;
|
||||
import com.hyperai.hyperlpr3.bean.Plate;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.hyperai.hyperlpr3.HyperLPR3;
|
||||
import com.hyperai.hyperlpr3.bean.HyperLPRParameter;
|
||||
import com.hyperai.hyperlpr3.bean.Plate;
|
||||
|
||||
/**
|
||||
* @author by hs-johnny
|
||||
* Created on 2019/6/17
|
||||
@@ -50,11 +48,7 @@ public class CameraPreviews extends SurfaceView implements SurfaceHolder.Callbac
|
||||
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mPaint.setStrokeWidth(2);
|
||||
mPaint.setStyle(Paint.Style.STROKE);
|
||||
// mPaint.setColor(ContextCompat.getColor(context, R.color.colorAccent));
|
||||
|
||||
HyperLPRParameter parameter = new HyperLPRParameter();
|
||||
// hyperLPR3 = new HyperLPR3();
|
||||
// hyperLPR3.init(mContext, parameter);
|
||||
}
|
||||
public Camera getCameraInstance(){
|
||||
if (mCamera == null){
|
||||
@@ -137,7 +131,6 @@ public class CameraPreviews extends SurfaceView implements SurfaceHolder.Callbac
|
||||
}
|
||||
|
||||
if(!isStopReg && plates.length > 0) {
|
||||
// isStopReg = true;
|
||||
sendPlate(plates);
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,4 +1,4 @@
|
||||
package com.hyperai.hyperlpr_sdk_demo;
|
||||
package com.hyperai.example.lpr3_demo;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
@@ -27,7 +27,6 @@ import com.yuyh.library.imgsel.config.ISListConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private Button cameraBtn;
|
||||
@@ -78,7 +77,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
verifyStoragePermissions(this);
|
||||
|
||||
|
||||
// 车牌识别算法配置参数
|
||||
HyperLPRParameter parameter = new HyperLPRParameter()
|
||||
.setDetLevel(HyperLPR3.DETECT_LEVEL_LOW)
|
||||
@@ -161,6 +159,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
if (bitmap != null) {
|
||||
|
||||
imageView.setImageBitmap(bitmap);
|
||||
// 调用车牌识别
|
||||
Plate[] plates = HyperLPR3.getInstance().plateRecognition(bitmap, HyperLPR3.CAMERA_ROTATION_0, HyperLPR3.STREAM_BGRA);
|
||||
for (Plate plate: plates) {
|
||||
String type = "未知车牌";
|
||||
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
@@ -1,3 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">HyperLPR3-App</string>
|
||||
<string name="app_name">HyperLPR3-Example</string>
|
||||
</resources>
|
||||
@@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.HyperLPR_SDK_Demo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<style name="Theme.HyperLPR3Example" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hyperai.hyperlpr_sdk_demo;
|
||||
package com.hyperai.example.lpr3_demo;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
Reference in New Issue
Block a user