项目作者: ekoz

项目描述 :
Ocr Api with Tesseract-ocr
高级语言: Java
项目地址: git://github.com/ekoz/ocr-api.git
创建时间: 2018-02-06T09:29:36Z
项目社区:https://github.com/ekoz/ocr-api

开源协议:

下载


Ocr Api with Tesseract-ocr

How to use

  1. HttpPost httppost = new HttpPost("http://localhost:8010/ocr-api/");
  2. FileBody bin = new FileBody(new File("E:\\OCR\\2233373112.jpg"));
  3. StringBody comment = new StringBody("A binary file of some kind", ContentType.TEXT_PLAIN);
  4. HttpEntity reqEntity = MultipartEntityBuilder.create()
  5. .addPart("file", bin)
  6. .addPart("comment", comment)
  7. .build();
  8. httppost.setEntity(reqEntity);
  9. CloseableHttpResponse response = httpclient.execute(httppost);
  10. try {
  11. System.out.println("----------------------------------------");
  12. System.out.println(response.getStatusLine());
  13. HttpEntity resEntity = response.getEntity();
  14. if (resEntity != null) {
  15. List<String> readLines = IOUtils.readLines(resEntity.getContent(), OcrApiUtils.UTF8);
  16. System.out.println("Response content length: " + resEntity.getContentLength());
  17. System.out.println(ListUtils.toString(readLines));
  18. }
  19. EntityUtils.consume(resEntity);
  20. } finally {
  21. response.close();
  22. }

Api

Api

demo

Demo

Demo