안 드 로 이 드 번호판 인식 시스템 EasyPR 사용 설명

위의 글 은 신분증 인식 을 소개 하 였 는데,지금 우 리 는 자동차 번호판 인식 에 대해 이야기 하고 있다.
EasyPR 은 개 원 된 중국어 번호판 식별 시스템 이다.gitHub 주소
EasyPR 은 다음 과 같은 특징 이 있 습 니 다.
1.openCV 라 는 오픈 소스 라 이브 러 리 를 기반 으로 모든 코드 를 쉽게 얻 을 수 있 음 을 의미 합 니 다.
2.중국 어 를 식별 할 수 있다.예 를 들 어 자동차 번호판 은 소 EK 722 의 그림 으로 std:string 형식의'소 EK 722'의 결 과 를 정확하게 출력 할 수 있다.
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 에 카메라 권한 을 추가 하 는 것 을 잊 지 마 세 요
app 이 실 행 될 때 자동차 번호판 한정 상자 가 있 고 상자 의 범위 내 에서 이미지 재단 을 하 며 인위적으로 식별 범 위 를 좁 히 고 식별 도 를 높 인 다.
본 라 이브 러 리 기반EasyPR_Android.
효과 그림:

마지막 으로 첨부demo 소스 코드
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.

좋은 웹페이지 즐겨찾기