|
|
|
@ -2,16 +2,30 @@ package com.docus.server;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.docus.server.vo.ocr.OcrResponse;
|
|
|
|
|
import com.docus.core.util.json.JSON;
|
|
|
|
|
import com.docus.server.vo.segmentation.FileDto;
|
|
|
|
|
import com.docus.server.vo.segmentation.UploadBatchFileParam;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
public class ImageProcessingExample {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
|
|
|
|
|
UploadBatchFileParam uploadBatchFileParam = new UploadBatchFileParam();
|
|
|
|
|
System.out.println(JSON.toJSON(uploadBatchFileParam));
|
|
|
|
|
|
|
|
|
|
FileDto fileDto = new FileDto();
|
|
|
|
|
System.out.println(JSON.toJSON(fileDto));
|
|
|
|
|
|
|
|
|
|
List<FileDto> fileDtoList = new ArrayList<>();
|
|
|
|
|
System.out.println(JSON.toJSON(fileDtoList));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 1. 调整图片大小
|
|
|
|
|
// ImgUtil.scale(FileUtil.file("input.jpg"), FileUtil.file("output.jpg"), 0.5f); // 将input.jpg缩小为原来的一半,并保存为output.jpg
|
|
|
|
|
|
|
|
|
@ -22,7 +36,7 @@ public class ImageProcessingExample {
|
|
|
|
|
// Image image = ImgUtil.rotate(ImageIO.read(FileUtil.file("C:\\Users\\dataexa\\Desktop\\麻醉.jpg")), 90);
|
|
|
|
|
// ImgUtil.write(image, FileUtil.file("C:\\Users\\dataexa\\Desktop\\output2.jpg"));
|
|
|
|
|
|
|
|
|
|
uploadByte("D:\\docus\\cut\\segmentation\\20230822\\c6b03e5767814895a2c155c32f174051\\麻醉.jpg");
|
|
|
|
|
// uploadByte("D:\\docus\\cut\\segmentation\\20230822\\c6b03e5767814895a2c155c32f174051\\麻醉.jpg");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void uploadByte(String path) {
|
|
|
|
@ -36,8 +50,8 @@ public class ImageProcessingExample {
|
|
|
|
|
.execute()
|
|
|
|
|
.body();
|
|
|
|
|
if (StrUtil.isNotBlank(body)) {
|
|
|
|
|
OcrResponse jsonRootBean = JSON.parseObject(body, OcrResponse.class);
|
|
|
|
|
System.out.println(jsonRootBean);
|
|
|
|
|
// OcrResponse jsonRootBean = JSON.parseObject(body, OcrResponse.class);
|
|
|
|
|
// System.out.println(jsonRootBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Boolean success = (Boolean)result.get("success");
|
|
|
|
|