车牌识别之Java调用EasyPR-linux篇

来源:互联网 发布:js动态生成表格9*9 编辑:程序博客网 时间:2024/06/03 17:49

转载路径 :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

上面的代码执行结果如下: 
这里写图片描述


原创粉丝点击