master
周文涛 2 years ago
parent 460ac40b45
commit 1b5b71eae2

@ -89,6 +89,8 @@ public class OcrIdentifyDetailController extends JeecgController<OcrIdentifyDeta
if (StringUtils.isNotBlank(record.getImageUrl())&&"customer_test".equals(systemProjectEnv)) { if (StringUtils.isNotBlank(record.getImageUrl())&&"customer_test".equals(systemProjectEnv)) {
//客户测试服务器 //客户测试服务器
if (!record.getImageUrl().contains("http:")&&!record.getImageUrl().contains("https:")) { if (!record.getImageUrl().contains("http:")&&!record.getImageUrl().contains("https:")) {
String imagePreviewUrl="http://47.103.213.109:8072/files"+record.getImageUrl();
record.setImagePreviewUrl(imagePreviewUrl);
//压缩图片 //压缩图片
if (StringUtils.isNotBlank(record.getThumbnailImageUrl())) { if (StringUtils.isNotBlank(record.getThumbnailImageUrl())) {
File file=new File(record.getThumbnailImageUrl()); File file=new File(record.getThumbnailImageUrl());
@ -100,13 +102,12 @@ public class OcrIdentifyDetailController extends JeecgController<OcrIdentifyDeta
//虚线图片 //虚线图片
if (StringUtils.isNotBlank(record.getDrawDashedImageUrl())) { if (StringUtils.isNotBlank(record.getDrawDashedImageUrl())) {
File file=new File(record.getDrawDashedImageUrl()); File file=new File(record.getDrawDashedImageUrl());
//当原图片存在时. //当虚线图片存在时,替换原图字段
if (file.exists()) { if (file.exists()) {
record.setDrawDashedImagePreviewUrl("http://47.103.213.109:8072/files"+record.getDrawDashedImageUrl()); record.setDrawDashedImagePreviewUrl("http://47.103.213.109:8072/files"+record.getDrawDashedImageUrl());
record.setImagePreviewUrl("http://47.103.213.109:8072/files"+record.getDrawDashedImageUrl());
} }
} }
String imagePreviewUrl="http://47.103.213.109:8072/files"+record.getImageUrl();
record.setImagePreviewUrl(imagePreviewUrl);
}else{ }else{
record.setImagePreviewUrl(record.getImageUrl()); record.setImagePreviewUrl(record.getImageUrl());
} }

@ -130,8 +130,6 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
//判断新目录是否存在,不存在则新建 //判断新目录是否存在,不存在则新建
FileOUtils.folderCreate(fileUrl); FileOUtils.folderCreate(fileUrl);
String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length()); String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
File thumbnailFile = new File(outputImagePath);
List<List<Point>> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult); List<List<Point>> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult);
if (resultToPoints.size()>0) { if (resultToPoints.size()>0) {
ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(),resultToPoints,outputImagePath); ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(),resultToPoints,outputImagePath);

@ -31,7 +31,7 @@ public class ImageUtils {
/* /*
Java使ImageIOThumbnailsJava Advanced Imaging APIJAI使ImageIO Java使ImageIOThumbnailsJava Advanced Imaging APIJAI使ImageIO
*/ */
public static void main(String[] args) throws FileNotFoundException { public static void main1(String[] args) throws FileNotFoundException {
String sourceImagePath = "C:\\Users\\Denim\\Desktop\\aabebdf71887c6c2707c65211cac2d3a.jpeg"; String sourceImagePath = "C:\\Users\\Denim\\Desktop\\aabebdf71887c6c2707c65211cac2d3a.jpeg";
String outputImagePath = "C:\\Users\\Denim\\Desktop\\ds-aabebdf71887c6c2707c65211cac2d3a.jpeg"; String outputImagePath = "C:\\Users\\Denim\\Desktop\\ds-aabebdf71887c6c2707c65211cac2d3a.jpeg";
//compressImage(sourceImagePath,outputImagePath,0.25f,0.25f); //compressImage(sourceImagePath,outputImagePath,0.25f,0.25f);

Loading…
Cancel
Save