介绍
这篇文章将为大家详细讲解有关怎么在android中利用EasyPR实现车牌识别系统,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
EasyPR有如下特点:
1。它基于openCV这个开源库,这意味着所有它的代码都可以轻易的获取。
2。它能够识别中文。例如车牌为苏EUK722的图片,它可以准确地输出std:字符串类型的“苏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 文本; @Override才能 protected 才能;void  onCreate (Bundle savedInstanceState), { ,,,super.onCreate (savedInstanceState); ,,,setContentView (R.layout.activity_main); ,,,easyPRPreView =, (EasyPRPreView), findViewById (R.id.preSurfaceView); ,,,btnShutter =,(按钮),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 原(),{ ,,,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 结果),{ ,,,,,,,if (result ==, null | |, result.equals (“0”)), { ,,,,,,,,,Toast.makeText (MainActivity.this,,“换个姿势试试!“,,Toast.LENGTH_SHORT),告诉(); ,,,,,,,},{else ,,,,,,,,,Toast.makeText (MainActivity.this,,“识别成功,,,Toast.LENGTH_SHORT),告诉(); ,,,,,,,,,text.setText(结果); ,,,,,,,} ,,,,,} ,,,}); ,,,btnShutter.setOnClickListener (new View.OnClickListener (), { ,,,,@Override ,,,,,public void onClick (View 视图),{ ,,,,,,,easyPRPreView.recognize();//开始识别 ,,,,,} ,,,}); ,,} }
布局文件
& lt; ? xml version=?.0“,编码=皍tf-8" ?比; & lt;使用 ,,xmlns: android=癶ttp://schemas.android.com/apk/res/android" android:才能layout_width=癿atch_parent" android:才能layout_height=癿atch_parent" android:才能背景=? 00000000“比; & lt; com.fosung.libeasypr.view.EasyPRPreView才能 ,,,android: id=癅 + id/preSurfaceView" ,,,android: layout_width=癿atch_parent" ,,,android: layout_height=癿atch_parent"/比; & lt;才能按钮 ,,,android: id=癅 + id/btnShutter" ,,,android: layout_width=皐rap_content" ,,,android: layout_height=皐rap_content" ,,,android: layout_alignParentBottom=皌rue" ,,,android: layout_centerHorizontal=皌rue" ,,,android: layout_marginBottom=?0 dp" ,,,android:文本=笆侗稹? ,,,android: textSize=?6 sp" ,,,android:输入textColor=? FFFFFF" null null null null null null null null null null null null null null null null null null null null null null怎么在android中利用EasyPR实现车牌识别系统