|
|
@ -976,6 +976,14 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
sourceJson.add(JSONObject.parseObject(String.format("{\"tag\":\"time\", \"inputText\":\"%s\"}", time)));
|
|
|
|
sourceJson.add(JSONObject.parseObject(String.format("{\"tag\":\"time\", \"inputText\":\"%s\"}", time)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONObject semanticResult = JSONObject.parseObject(ocrIdentifyDetail.getSemanticResult());
|
|
|
|
JSONObject semanticResult = JSONObject.parseObject(ocrIdentifyDetail.getSemanticResult());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断是不是网络图片
|
|
|
|
|
|
|
|
Boolean onlineFile = FileOUtils.isOnlineFile(imgPath);
|
|
|
|
|
|
|
|
if (onlineFile) {
|
|
|
|
|
|
|
|
//如果是网络图片,则将图片下载
|
|
|
|
|
|
|
|
imgPath = FileOUtils.downLoadFromUrl(imgPath, FileOUtils.getFileName(imgPath), OcrConstant.FILE_DOWNLOAD_URL_PREFIX);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
File file = new File(imgPath);
|
|
|
|
File file = new File(imgPath);
|
|
|
|
//当原图片存在时.
|
|
|
|
//当原图片存在时.
|
|
|
|
if (file.exists()) {
|
|
|
|
if (file.exists()) {
|
|
|
@ -995,14 +1003,16 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
}*/
|
|
|
|
}*/
|
|
|
|
//绘制虚线
|
|
|
|
//绘制虚线
|
|
|
|
if (true) {
|
|
|
|
if (true) {
|
|
|
|
JSONObject semanticResult2 = JSONObject.parseObject(ocrIdentifyDetail.getSemanticResult()).getJSONObject("semantic_result");
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject semanticResult2 = semanticResult.getJSONObject("semantic_result");
|
|
|
|
String fileUrl = "/data/ocrImage/drawDashed" + imgPath.substring(0, i);
|
|
|
|
String fileUrl = "/data/ocrImage/drawDashed" + imgPath.substring(0, i);
|
|
|
|
|
|
|
|
|
|
|
|
//判断新目录是否存在,不存在则新建
|
|
|
|
//判断新目录是否存在,不存在则新建
|
|
|
|
FileOUtils.folderCreate(fileUrl);
|
|
|
|
FileOUtils.folderCreate(fileUrl);
|
|
|
|
String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
|
|
|
|
String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
|
|
|
|
if (semanticResult2!=null) {
|
|
|
|
if (semanticResult2!=null) {
|
|
|
|
List<List<Point>> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult2);
|
|
|
|
List<List<Point>> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult2);
|
|
|
|
if (resultToPoints.size() > 0) {
|
|
|
|
if (CollectionUtils.isNotEmpty(resultToPoints)) {
|
|
|
|
ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(), resultToPoints, outputImagePath);
|
|
|
|
ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(), resultToPoints, outputImagePath);
|
|
|
|
imgPath = outputImagePath;
|
|
|
|
imgPath = outputImagePath;
|
|
|
|
}
|
|
|
|
}
|
|
|
|