車牌識別之Java調用EasyPR-linux篇

轉載路徑 :http://blog.csdn.net/gao36951/article/details/52848967

題記

http://blog.csdn.net/gao36951/article/details/52848017 
http://blog.csdn.net/gao36951/article/details/52847940 
前兩篇介紹了OpenCV和EasyPR的安裝,現在我們來看看Java中的調用

代碼

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class EasyPrTest {

    public static void main(String[] args) {
        String cmd = "/opencv/EasyPR/demo recognize -p resources/image/plate_recognize.jpg --svm resources/model/svm.xml --ann resources/model/ann.xml";
        StringBuffer output = new StringBuffer();
        Process p = null;
        try {
            p = Runtime.getRuntime().exec(cmd);
            p.waitFor();

            BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

            String line = "";

            while ((line = reader.readLine()) != null) {

                output.append(line + "\n");
            }
            System.out.println(output.toString());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

上面的代碼執行結果如下: 
這裏寫圖片描述


發佈了27 篇原創文章 · 獲贊 3 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章