国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

android車牌識別系統EasyPR使用詳解

2019-10-21 21:32:50
字體:
來源:轉載
供稿:網友

上篇文章介紹了身份證識別,現在我們來說說關于車牌識別。

EasyPR是一個開源的中文車牌識別系統,gitHub地址

EasyPR有如下特點:

1. 它基于openCV這個開源庫,這意味著所有它的代碼都可以輕易的獲取。 
2. 它能夠識別中文。例如車牌為蘇EUK722的圖片,它可以準確地輸出std:string類型的”蘇EUK722”的結果。 
3. 它的識別率較高。目前情況下,字符識別已經可以達到90%以上的精度。

使用方法

package com.android.guocheng.easypr;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import android.view.View;import android.widget.Button;import android.widget.TextView;import android.widget.Toast;import com.fosung.libeasypr.view.EasyPRPreSurfaceView;import com.fosung.libeasypr.view.EasyPRPreView;public class MainActivity extends AppCompatActivity {  private EasyPRPreView easyPRPreView;  private Button btnShutter;  private TextView text;  @Override  protected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.activity_main);    easyPRPreView = (EasyPRPreView) findViewById(R.id.preSurfaceView);    btnShutter = (Button) findViewById(R.id.btnShutter);    text = (TextView) findViewById(R.id.text);    initListener();  }  @Override  protected void onStart() {    super.onStart();    if (easyPRPreView != null) {      easyPRPreView.onStart();    }  }  @Override  protected void onStop() {    super.onStop();    if (easyPRPreView != null) {      easyPRPreView.onStop();    }  }  @Override  protected void onDestroy() {    super.onDestroy();    if (easyPRPreView != null) {      easyPRPreView.onDestroy();    }  }  private void initListener() {    easyPRPreView.setRecognizedListener(new EasyPRPreSurfaceView.OnRecognizedListener() {      @Override      public void onRecognized(String result) {        if (result == null || result.equals("0")) {          Toast.makeText(MainActivity.this, "換個姿勢試試!", Toast.LENGTH_SHORT).show();        } else {          Toast.makeText(MainActivity.this, "識別成功", Toast.LENGTH_SHORT).show();          text.setText(result);        }      }    });    btnShutter.setOnClickListener(new View.OnClickListener() {      @Override      public void onClick(View view) {        easyPRPreView.recognize();//開始識別      }    });  }}

布局文件

<?xml version="1.0" encoding="utf-8"?><RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="#00000000">  <com.fosung.libeasypr.view.EasyPRPreView    android:id="@+id/preSurfaceView"    android:layout_width="match_parent"    android:layout_height="match_parent"/>  <Button    android:id="@+id/btnShutter"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_alignParentBottom="true"    android:layout_centerHorizontal="true"    android:layout_marginBottom="10dp"    android:text="識別"    android:textSize="16sp"    android:textColor="#FFFFFF"    android:background="@color/colorAccent"/>  <TextView    android:id="@+id/title"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:layout_marginTop="15dp"    android:gravity="center"    android:textColor="#FFFFFF"    android:textSize="16dp"    android:text="請將車牌放入框內"/>  <TextView    android:id="@+id/text"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:layout_marginTop="5dp"    android:gravity="center"    android:textColor="#FFFFFF"    android:textSize="18dp"    android:layout_below="@+id/title"/></RelativeLayout>

別忘了在manifest加入攝像機權限<uses-permission android:name="android.permission.CAMERA" /> 
app在運行時,有車牌限定框,在框的范圍內進行圖像裁剪,人為縮小了識別范圍,提高識別度。 
本庫基于EasyPR_Android

效果圖:

android,車牌識別系統,EasyPR

最后附上demo源碼

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到Android開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 株洲市| 辉县市| 温泉县| 龙川县| 曲阳县| 襄城县| 晋中市| 依安县| 上思县| 团风县| 昌图县| 繁峙县| 留坝县| 莒南县| 长治市| 潢川县| 读书| 固镇县| 屯昌县| 吴忠市| 新建县| 洞口县| 崇信县| 房产| 通化县| 云林县| 湖南省| 昌都县| 长丰县| 灵丘县| 宁晋县| 井冈山市| 西盟| 泰州市| 雷州市| 香港| 军事| 罗田县| 万宁市| 平遥县| 福贡县|