This commit is contained in:
quyixiao 2025-03-23 14:34:53 +08:00
parent ba3fa83588
commit a1d2904701
2 changed files with 43 additions and 1 deletions

View File

@ -40,6 +40,9 @@ public class WebImageLocLineController {
@CacheResult
public R recognize(BWebImageLocRequest request) {
request.setRecognizeGranularity("big");
List<WebImageLocLineResp> respList = new ArrayList<>();
ApiR<BWebImageLocResp> 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<WebImageLocLineResp.CharsDTO> 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);
}
}

View File

@ -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;
}
}
}