diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/common/WebImageLocLineController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/common/WebImageLocLineController.java index a573204..0acafc6 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/controller/common/WebImageLocLineController.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/common/WebImageLocLineController.java @@ -40,6 +40,9 @@ public class WebImageLocLineController { @CacheResult public R recognize(BWebImageLocRequest request) { + + request.setRecognizeGranularity("big"); + List respList = new ArrayList<>(); ApiR bR = bWebImageLocHandle.handle(request); @@ -57,7 +60,6 @@ public class WebImageLocLineController { WebImageLocLineResp.LocationDTO locationDTO = new WebImageLocLineResp.LocationDTO(); if(wordsResultDTO.getProbability() !=null){ - probabilityDTO.setMin(wordsResultDTO.getProbability().getMin()); probabilityDTO.setVariance(wordsResultDTO.getProbability().getVariance()); probabilityDTO.setAverage(wordsResultDTO.getProbability().getAverage()); @@ -71,10 +73,29 @@ public class WebImageLocLineController { locationDTO.setHeight(wordsResultDTO.getLocation().getHeight()); } + resp.setDirection(bWebImageLocResp.getDirection() + ""); resp.setProbability(probabilityDTO); resp.setLocation(locationDTO); + List chars = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(wordsResultDTO.getChars())){ + for (BWebImageLocResp.WordsResultDTO.CharsDTO aChar : wordsResultDTO.getChars()) { + WebImageLocLineResp.CharsDTO c = new WebImageLocLineResp.CharsDTO(); + c.setCharX(aChar.getCharX()); + + if(aChar.getLocation() !=null){ + WebImageLocLineResp.CharsDTO.LocationDTO location = new WebImageLocLineResp.CharsDTO.LocationDTO(); + + location.setTop(aChar.getLocation().getTop()); + location.setLeft(aChar.getLocation().getLeft()); + location.setWidth(aChar.getLocation().getWidth()); + location.setHeight(aChar.getLocation().getHeight()); + c.setLocation(location); + } + chars.add(c); + } + } respList.add(resp); } } diff --git a/api-web/api-interface/src/main/java/com/heyu/api/resp/common/WebImageLocLineResp.java b/api-web/api-interface/src/main/java/com/heyu/api/resp/common/WebImageLocLineResp.java index de4cd4c..336bc7a 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/resp/common/WebImageLocLineResp.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/resp/common/WebImageLocLineResp.java @@ -35,6 +35,9 @@ public class WebImageLocLineResp extends BaseResp { private LocationDTO location; + private CharsDTO chars; + + // 当 probability=true 时返回该字段。识别结果中每一行的置信度值,包含average:行置信度平均值,variance:行置信度方差,min:行置信度最小值 @NoArgsConstructor @@ -55,4 +58,22 @@ public class WebImageLocLineResp extends BaseResp { } + + + @NoArgsConstructor + @Data + public static class CharsDTO { + private String charX; + private LocationDTO location; + + @NoArgsConstructor + @Data + public static class LocationDTO { + private Integer top; + private Integer left; + private Integer width; + private Integer height; + } + } + }