KO
|
EN
gitlite — search
Search
#python
#react
#typescript
#nodejs
#hacktoberfest
#mongodb
#machine-learning
#javascript
#python3
#reactjs
#github
#vue
PaddleOCR-json-java-api
★ 38
Open GitHub ↗
No description available.
Download README (.md)
Explore Similar Repositories
NewOCR
:
A custom OCR library in pure Java made as a replacement for MS Paint IDE's OCR
Aspose.OCR-for-Java
:
Aspose.OCR for Java Examples and Sample Projects
java-ocr
:
java ocr 开源项目,含sdk,web app | An OCR project implemented in Java, including SDK, web application.
veryfi-java
:
Java module for communicating with the Veryfi OCR API.
siam-finance
:
暹罗记账是一款Java记账系统,该系统包含数据中心、资金管理、基金投资、股票投资、可转债投资、系统配置等核心功能,支持OCR一键识别录入。基于 Spring Boot + MyBatis Plus + Vue & Element + uni-app 技术栈进行开发;
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
PaddleOCR-json-java-api
?
Download (.md)
# PaddleOCR-json-java-api [](https://github.com/jerrylususu/PaddleOCR-json-java-api/actions/workflows/ci.yml) [PaddleOCR-json](https://github.com/hiroi-sora/PaddleOCR-json) 的简单 Java 封装。 v1.2 支持本地进程方式,v1.3 支持本地进程&套接字服务客户端方式,v1.4 支持 Linux 版本。 ## 依赖 - Gson - Java 8 或更新版本 ## 使用 1. 在项目中引入 'Ocr.java' 2. 参考如下代码片段调用 OCR (或参考完整示例 [Main.java](https://github.com/jerrylususu/PaddleOCR-json-java-api/blob/main/src/main/java/org/example/Main.java)) > 如果在 Linux 下使用,请参阅 [此 Issue](https://github.com/jerrylususu/PaddleOCR-json-java-api/issues/8) 。 ```java // 可选的配置项 Map<String, Object> arguments = new HashMap<>(); // arguments.put("use_angle_cls", true); // 使用本地进程方式初始化 OCR String exePath = "path/to/executable"; // paddleocr_json 的可执行文件所在路径 try (Ocr ocr = new Ocr(new File(exePath), arguments)) { // 使用套接字服务方式初始化 OCR(仅作为客户端,不启动服务) // try (Ocr ocr = new Ocr(serverAddr, serverPort, arguments)) { // 对一张图片进行 OCR String imgPath = "path/to/img"; OcrResponse resp = ocr.runOcr(new File(imgPath)); // 或者对图片的二进制数据/Base64后的图片进行 OCR // byte[] fileBytes = Files.readAllBytes(Paths.get(imgPath)); // OcrResponse resp = ocr.runOcrOnImgBytes(fileBytes); // OcrResponse resp = ocr.runOcrOnImgBase64("base64img"); // 或者直接识别剪贴板中的图片 // OcrResponse resp = ocr.runOcrOnClipboard(); // 读取结果 if (resp.code == OcrCode.OK) { for (OcrEntry entry : resp.data) { System.out.println(entry.text); } } else { System.out.println("error: code=" + resp.code + " msg=" + resp.msg); } } catch (IOException e) { e.printStackTrace(); } ``` ## 参考 - Unicode 转换为 ASCII 序列: [EscapedWriter (Soot Project)](https://github.com/soot-oss/soot/blob/3966f565db6dc2882c3538ffc39e44f4c14b5bcf/src/main/java/soot/util/EscapedWriter.java)