master
周文涛 2 years ago
parent c0a939fc42
commit 27a143c65b

@ -976,6 +976,38 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
sourceJson.add(JSONObject.parseObject(String.format("{\"tag\":\"time\", \"inputText\":\"%s\"}", time)));
}
JSONObject semanticResult = JSONObject.parseObject(semanticResultJson);
File file = new File(imgPath);
//当原图片存在时.
if (file.exists()) {
int i = imgPath.lastIndexOf("/");
//压缩图片
/*if (true) {
String fileUrl = "/data/ocrImage/thumbnail" + imgPath.substring(0, i);
//判断新目录是否存在,不存在则新建
FileOUtils.folderCreate(fileUrl);
String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
File thumbnailFile = new File(outputImagePath);
//如果上次生成过缩率图,就不生成了
if (!thumbnailFile.exists()) {
ImageUtils.compressImage(file.getAbsolutePath(), outputImagePath, 0.3f, 0.3f);
}
ocrIdentifyDetail.setThumbnailImageUrl(outputImagePath);
}*/
//绘制虚线
if (true) {
String fileUrl = "/data/ocrImage/drawDashed" + imgPath.substring(0, i);
//判断新目录是否存在,不存在则新建
FileOUtils.folderCreate(fileUrl);
String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
List<List<Point>> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult);
if (resultToPoints.size() > 0) {
ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(), resultToPoints, outputImagePath);
imgPath = outputImagePath;
}
}
}
OcrRuleCheckDTO ocrRuleCheckVo = ocrRuleCheckService.findById(simulateChecksVO.getRuleCheckId());
Map<String, CheckSemanticModel> checkSemanticModelMap = getCheckSemanticModelMap(ocrRuleCheckVo.getConfigRuleMap(), ocrRuleCheckVo.getFieldMap(), sourceJson);
String text = null;//ocr 识别的文本

Loading…
Cancel
Save