提交修改
This commit is contained in:
parent
916f9f079e
commit
57ff3a2693
@ -18,4 +18,9 @@ public class BRemoveHandwritingResp extends BBaseResp {
|
||||
private String imageProcessed;
|
||||
@JsonProperty("log_id")
|
||||
private Long logId;
|
||||
@JsonProperty("pdf_file_size")
|
||||
private String pdfFileSize;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -20,4 +20,9 @@ public class BRemoveMoireResp extends BBaseResp {
|
||||
private String imageProcessed;
|
||||
@JsonProperty("log_id")
|
||||
private Long logId;
|
||||
|
||||
|
||||
@JsonProperty("pdf_file_size")
|
||||
private String pdfFileSize;
|
||||
|
||||
}
|
||||
|
||||
@ -24,6 +24,11 @@ public class BDocCropEnhanceResp extends BBaseResp {
|
||||
private String imageProcessed;
|
||||
@JsonProperty("log_id")
|
||||
private Long logId;
|
||||
/***
|
||||
* 传入PDF文件的总页数,当 pdf_file 参数有效时返回该字段
|
||||
*/
|
||||
@JsonProperty("pdf_file_size")
|
||||
private Long pdfFileNum;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
|
||||
@ -31,8 +31,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* 文档解析-获取结果
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/text")
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.heyu.api.controller.doc;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.doc.BDocClassifyHandle;
|
||||
import com.heyu.api.baidu.request.doc.BDocClassifyRequest;
|
||||
import com.heyu.api.baidu.response.doc.BDocClassifyResp;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.doc.DocClassifyResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/***
|
||||
* https://console.bce.baidu.com/support/?_=1740667714316×tamp=1742716755429#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E6%96%87%E6%A1%A3%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86&api=rest%2F2.0%2Focr%2Fv1%2Fdoc_classify&method=post
|
||||
*
|
||||
*
|
||||
* 文件检测分类
|
||||
*
|
||||
* 接口描述
|
||||
* 对图片中的文档、卡证、票据等含文字的主体进行检测、分类,可同时支持一张图片中多张主体的情况,返回每个主体的类别及位置信息。
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/doc")
|
||||
@NotIntercept
|
||||
public class DocClassifyController {
|
||||
|
||||
@Autowired
|
||||
private BDocClassifyHandle bDocClassifyHandle;
|
||||
|
||||
|
||||
@RequestMapping("/classify")
|
||||
@CacheResult
|
||||
public R classify(BDocClassifyRequest request) {
|
||||
List<DocClassifyResp> respList = new ArrayList<>();
|
||||
ApiR<BDocClassifyResp> bR = bDocClassifyHandle.handle(request);
|
||||
if (bR.isSuccess()) {
|
||||
BDocClassifyResp bDocClassifyResp = bR.getData();
|
||||
if (CollectionUtils.isNotEmpty(bDocClassifyResp.getWordsResult())) {
|
||||
for (BDocClassifyResp.WordsResultDTO wordsResultDTO : bDocClassifyResp.getWordsResult()) {
|
||||
DocClassifyResp resp = new DocClassifyResp();
|
||||
resp.setProbablity(wordsResultDTO.getProbablity());
|
||||
resp.setType(wordsResultDTO.getType());
|
||||
respList.add(resp);
|
||||
}
|
||||
return R.ok().setData(respList);
|
||||
}
|
||||
}
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.heyu.api.controller.doc;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.doc.BDocCropEnhanceHandle;
|
||||
import com.heyu.api.baidu.request.doc.BDocCropEnhanceRequest;
|
||||
import com.heyu.api.baidu.response.others.BDocCropEnhanceResp;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.doc.DocCropEnhanceResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/***
|
||||
* https://console.bce.baidu.com/support/?_=1740667714316×tamp=1742718224202#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E6%96%87%E6%A1%A3%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86&api=rest%2F2.0%2Focr%2Fv1%2Fdoc_crop_enhance&method=post
|
||||
*
|
||||
*文档矫正增强
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 对图片中的文件、卡证、票据等内容进行四角点检测定位,提取主体内容并对其进行矫正,同时可选图片增强效果进一步提升图片清晰度,达到主体检测矫正并增强的目的,提升图片整体质量。示意图如下:
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/doc")
|
||||
@NotIntercept
|
||||
public class DocCropEnhanceController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private BDocCropEnhanceHandle bDocCropEnhanceHandle;
|
||||
|
||||
@RequestMapping("/cropEnhance")
|
||||
@CacheResult
|
||||
public R cropEnhance(BDocCropEnhanceRequest request) {
|
||||
DocCropEnhanceResp resp = new DocCropEnhanceResp();
|
||||
|
||||
ApiR<BDocCropEnhanceResp> bR = bDocCropEnhanceHandle.handle(request);
|
||||
|
||||
|
||||
if (bR.isSuccess()) {
|
||||
BDocCropEnhanceResp bDocCropEnhanceResp = bR.getData();
|
||||
|
||||
resp.setImageProcessed(bDocCropEnhanceResp.getImageProcessed());
|
||||
resp.setPdfFileSize(bDocCropEnhanceResp.getPdfFileNum() + "");
|
||||
|
||||
return R.ok().setData(resp);
|
||||
|
||||
}
|
||||
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.heyu.api.controller.doc;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.doc.BDocRepairHandle;
|
||||
import com.heyu.api.baidu.request.doc.BDocRepairRequest;
|
||||
import com.heyu.api.baidu.response.doc.BDocRepairResp;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.doc.DocRepairResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/***
|
||||
*
|
||||
* https://console.bce.baidu.com/support/?_=1740667714316×tamp=1742718778563#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E6%96%87%E6%A1%A3%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86&api=rest%2F2.0%2Fimage-process%2Fv1%2Fdoc_repair&method=post
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 自动识别并去除文档图片中的底纹,使图片更加清晰,便于阅读。示意图如下:
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/doc")
|
||||
@NotIntercept
|
||||
public class DocRepairController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BDocRepairHandle bDocRepairHandle;
|
||||
|
||||
@RequestMapping("/repair")
|
||||
@CacheResult
|
||||
public R repair(BDocRepairRequest request) {
|
||||
DocRepairResp resp = new DocRepairResp();
|
||||
|
||||
ApiR<BDocRepairResp> bR = bDocRepairHandle.handle(request);
|
||||
if (bR.isSuccess()) {
|
||||
BDocRepairResp bDocRepairResp = bR.getData();
|
||||
|
||||
resp.setImageURL(bDocRepairResp.getResult());
|
||||
return R.ok().setData(resp);
|
||||
|
||||
}
|
||||
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.heyu.api.controller.doc;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.doc.BRemoveHandwritingHandle;
|
||||
import com.heyu.api.baidu.request.doc.BRemoveHandwritingRequest;
|
||||
import com.heyu.api.baidu.response.doc.BRemoveHandwritingResp;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.doc.RemoveHandwritingResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/***
|
||||
* https://console.bce.baidu.com/support/?_=1740667714316×tamp=1742718885645#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E6%96%87%E6%A1%A3%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86&api=%2Frest%2F2.0%2Focr%2Fv1%2Fremove_handwriting&method=post
|
||||
*
|
||||
* 文档去手写
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 去除图片中的手写内容,保留印刷体内容,可用于试卷去手写还原等场景。示意图如下:
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/doc")
|
||||
@NotIntercept
|
||||
public class RemoveHandwritingController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BRemoveHandwritingHandle bRemoveHandwritingHandle;
|
||||
|
||||
@RequestMapping("/repair")
|
||||
@CacheResult
|
||||
public R repair(BRemoveHandwritingRequest request) {
|
||||
|
||||
RemoveHandwritingResp resp = new RemoveHandwritingResp();
|
||||
|
||||
|
||||
ApiR<BRemoveHandwritingResp> bR = bRemoveHandwritingHandle.handle(request);
|
||||
if (bR.isSuccess()) {
|
||||
|
||||
BRemoveHandwritingResp bRemoveHandwritingResp = bR.getData();
|
||||
|
||||
resp.setImageBase64(bRemoveHandwritingResp.getImageProcessed());
|
||||
resp.setPdfFileSize(bRemoveHandwritingResp.getPdfFileSize());
|
||||
|
||||
|
||||
return R.ok().setData(resp);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return R.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.heyu.api.controller.doc;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.doc.BRemoveMoireHandle;
|
||||
import com.heyu.api.baidu.request.doc.BRemoveMoireRequest;
|
||||
import com.heyu.api.baidu.response.doc.BRemoveMoireResp;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.doc.RemoveMoireResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/***
|
||||
* https://console.bce.baidu.com/support/?_=1740667714316×tamp=1740671115065#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E6%96%87%E6%A1%A3%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86&api=rest%2F2.0%2Fimage-process%2Fv1%2Fremove_moire&method=post
|
||||
*
|
||||
* 图片去摩尔纹
|
||||
*
|
||||
* 去除翻拍电脑、手机等显示屏照片中的摩尔纹,使图片更加清晰。示例图如下:
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/doc")
|
||||
@NotIntercept
|
||||
public class RemoveMoireController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BRemoveMoireHandle bRemoveMoireHandle;
|
||||
|
||||
|
||||
@RequestMapping("/repair")
|
||||
@CacheResult
|
||||
public R repair(BRemoveMoireRequest request) {
|
||||
|
||||
RemoveMoireResp resp = new RemoveMoireResp();
|
||||
|
||||
ApiR<BRemoveMoireResp> bR = bRemoveMoireHandle.handle(request);
|
||||
if (bR.isSuccess()) {
|
||||
BRemoveMoireResp bRemoveMoireResp = bR.getData();
|
||||
|
||||
|
||||
resp.setImageBase64(bRemoveMoireResp.getImageProcessed());
|
||||
resp.setPdfFileSize(bRemoveMoireResp.getPdfFileSize());
|
||||
|
||||
return R.ok().setData(resp);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return R.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.heyu.api.resp.doc;
|
||||
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DocClassifyResp extends BaseResp {
|
||||
|
||||
/***
|
||||
* 分类置信度
|
||||
*/
|
||||
private Double probablity;
|
||||
/***
|
||||
* 类别信息,当前可输出类别列表见下文「附录:类别列表」
|
||||
*/
|
||||
private String type;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.heyu.api.resp.doc;
|
||||
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DocCropEnhanceResp extends BaseResp {
|
||||
|
||||
/***
|
||||
* 返回处理后的图片,base64编码,如请求参数 scan_type = 1&enhance_type =0,则返回原图
|
||||
*/
|
||||
private String imageProcessed;
|
||||
|
||||
|
||||
/***
|
||||
* 传入PDF文件的总页数,当 pdf_file 参数有效时返回该字段
|
||||
*/
|
||||
private String pdfFileSize;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.heyu.api.resp.doc;
|
||||
|
||||
import com.heyu.api.resp.CommonImageUrlResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DocRepairResp extends CommonImageUrlResp {
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.heyu.api.resp.doc;
|
||||
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RemoveHandwritingResp extends BaseResp {
|
||||
/***
|
||||
* 返回处理后的图片,base64编码
|
||||
*/
|
||||
private String imageBase64;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* 传入PDF文件的总页数,当 pdf_file 参数有效时返回该字段
|
||||
*
|
||||
*/
|
||||
private String pdfFileSize;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.heyu.api.resp.doc;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RemoveMoireResp extends BaseResp {
|
||||
|
||||
|
||||
/***
|
||||
* 返回处理后的图片,base64编码
|
||||
*/
|
||||
private String imageBase64;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* 传入PDF文件的总页数,当 pdf_file 参数有效时返回该字段
|
||||
*
|
||||
*/
|
||||
private String pdfFileSize;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user