diff --git a/README.md b/README.md index 9261205..1ba06dd 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,7 @@ SmartJavaAI是专为JAVA 开发者打造的一个功能丰富、开箱即用的 cn.smartjavaai smartjavaai-all - 1.0.14 + 1.0.15 ``` ### 3、完整示例代码 @@ -295,7 +295,7 @@ SmartJavaAI是专为JAVA 开发者打造的一个功能丰富、开箱即用的 ## 近期更新日志 -## [v1.0.14] - 2025-05-17 +## [v1.0.15] - 2025-05-17 - 新增OCR文字识别模块:支持最新 PP-OCRv5 - OCR文本识别:支持文字方向检测与自动校正 diff --git a/examples/pom.xml b/examples/pom.xml index 04d1f09..38216a9 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -12,7 +12,7 @@ 11 11 UTF-8 - 1.0.14 + 1.0.15 smartai.examples.face.facerec.RetinaFaceDemo diff --git a/pom.xml b/pom.xml index c5aeed1..9f087ed 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.smartjavaai smartjavaai-parent - 1.0.14 + 1.0.15 pom SmartJavaAI diff --git a/smartjavaai-all/pom.xml b/smartjavaai-all/pom.xml index da2f8c4..4b4dca0 100644 --- a/smartjavaai-all/pom.xml +++ b/smartjavaai-all/pom.xml @@ -6,11 +6,11 @@ cn.smartjavaai smartjavaai-parent - 1.0.14 + 1.0.15 smartjavaai-all - 1.0.14 + 1.0.15 ${project.artifactId} SmartJavaAI https://github.com/geekwenjie/SmartJavaAI @@ -43,6 +43,12 @@ ${project.version} + + cn.smartjavaai + smartjavaai-ocr + ${project.version} + + diff --git a/smartjavaai-bom/pom.xml b/smartjavaai-bom/pom.xml index 62207ec..3bb75ed 100644 --- a/smartjavaai-bom/pom.xml +++ b/smartjavaai-bom/pom.xml @@ -6,10 +6,10 @@ cn.smartjavaai smartjavaai-parent - 1.0.14 + 1.0.15 - 1.0.14 + 1.0.15 smartjavaai-bom smartjavaai-bom 统一版本管理的 BOM 包,同时支持 import 和全量依赖 diff --git a/smartjavaai-common/pom.xml b/smartjavaai-common/pom.xml index 858ec49..4358e15 100644 --- a/smartjavaai-common/pom.xml +++ b/smartjavaai-common/pom.xml @@ -6,7 +6,7 @@ cn.smartjavaai smartjavaai-parent - 1.0.14 + 1.0.15 smartjavaai-common diff --git a/smartjavaai-face/pom.xml b/smartjavaai-face/pom.xml index fba8b96..3d07ae9 100644 --- a/smartjavaai-face/pom.xml +++ b/smartjavaai-face/pom.xml @@ -6,11 +6,11 @@ cn.smartjavaai smartjavaai-parent - 1.0.14 + 1.0.15 smartjavaai-face - 1.0.14 + 1.0.15 smartjavaai-face SmartJavaAI https://github.com/geekwenjie/SmartJavaAI diff --git a/smartjavaai-objectdetection/pom.xml b/smartjavaai-objectdetection/pom.xml index 53cdcaf..1da7a24 100644 --- a/smartjavaai-objectdetection/pom.xml +++ b/smartjavaai-objectdetection/pom.xml @@ -6,11 +6,11 @@ cn.smartjavaai smartjavaai-parent - 1.0.14 + 1.0.15 smartjavaai-objectdetection - 1.0.14 + 1.0.15 smartjavaai-objectdetection SmartJavaAI https://github.com/geekwenjie/SmartJavaAI diff --git a/smartjavaai-ocr/pom.xml b/smartjavaai-ocr/pom.xml index 9ac0d67..c12254d 100644 --- a/smartjavaai-ocr/pom.xml +++ b/smartjavaai-ocr/pom.xml @@ -6,7 +6,7 @@ cn.smartjavaai smartjavaai-parent - 1.0.14 + 1.0.15 smartjavaai-ocr @@ -20,7 +20,7 @@ - 1.0.14 + 1.0.15 smartjavaai-ocr SmartJavaAI https://github.com/geekwenjie/SmartJavaAI diff --git a/smartjavaai-ocr/src/main/java/cn/smartjavaai/ocr/model/common/direction/PPOCRMobileV2Model.java b/smartjavaai-ocr/src/main/java/cn/smartjavaai/ocr/model/common/direction/PPOCRMobileV2Model.java index 05ace1c..8ca5497 100644 --- a/smartjavaai-ocr/src/main/java/cn/smartjavaai/ocr/model/common/direction/PPOCRMobileV2Model.java +++ b/smartjavaai-ocr/src/main/java/cn/smartjavaai/ocr/model/common/direction/PPOCRMobileV2Model.java @@ -47,6 +47,7 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.UUID; /** * PPOCRMobileV2Model 方向分类模型 @@ -177,13 +178,12 @@ public class PPOCRMobileV2Model implements OcrDirectionModel { if (subImg.getHeight() * 1.0 / subImg.getWidth() > 1.5) { //旋转图片90度 subImg = OcrUtils.rotateImg(manager, subImg); - //ImageUtils.saveImage(subImg, i + "rotate.png", "build/output"); //检测方向 directionInfo = predictor.predict(subImg); if (directionInfo.getName().equalsIgnoreCase("Rotate")) { - angle = "90"; - } else { angle = "270"; + } else { + angle = "90"; } }else{ //横向 directionInfo = predictor.predict(subImg); diff --git a/smartjavaai-ocr/src/main/java/cn/smartjavaai/ocr/model/common/recognize/PpOCRV5RecModel.java b/smartjavaai-ocr/src/main/java/cn/smartjavaai/ocr/model/common/recognize/PpOCRV5RecModel.java index 4712051..113c86a 100644 --- a/smartjavaai-ocr/src/main/java/cn/smartjavaai/ocr/model/common/recognize/PpOCRV5RecModel.java +++ b/smartjavaai-ocr/src/main/java/cn/smartjavaai/ocr/model/common/recognize/PpOCRV5RecModel.java @@ -48,10 +48,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; /** @@ -158,8 +155,10 @@ public class PpOCRV5RecModel implements OcrCommonRecModel { for (OcrItem ocrItem : ocrItemList){ //放射变换+裁剪 Image subImage = OcrUtils.transformAndCrop(srcMat, ocrItem.getOcrBox()); + //ImageUtils.saveImage(subImage, UUID.randomUUID().toString() + "_aaa.png", "build/output"); //纠正文本框 subImage = OcrUtils.rotateImg(subImage, ocrItem.getAngle()); + //ImageUtils.saveImage(subImage, UUID.randomUUID().toString() + "_bbb.png", "build/output"); //识别 String name = predictor.predict(subImage); ocrItem.setText(name);