1. 程式人生 > >車牌識別之Java呼叫EasyPR-linux篇

車牌識別之Java呼叫EasyPR-linux篇

題記

程式碼

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(); } } }

上面的程式碼執行結果如下:
這裡寫圖片描述