This commit is contained in:
2025-11-07 14:27:05 +08:00
parent 86b44282ea
commit 864eb1462f
4 changed files with 14 additions and 11 deletions

View File

@ -42,6 +42,7 @@ public class BaiDuFace {
private static final String FACE_COMPARE_URL = "https://aip.baidubce.com/rest/2.0/face/v3/match?access_token=%s";
/**
* 人脸识别+人脸检测
*
@ -147,7 +148,6 @@ public class BaiDuFace {
}
}
/**
* 人脸对比(计算人脸相似度)
*

View File

@ -13,16 +13,18 @@ import org.springframework.stereotype.Component;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.FileNameMap;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLConnection;
import java.io.*;
import java.net.*;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* @author lilemy
* @date 2025/7/21 10:56
@ -34,6 +36,7 @@ public class RecognizerManager {
@Resource
private RecognizerProperties recognizerProperties;
/**
* 识别图片
*
@ -65,7 +68,7 @@ public class RecognizerManager {
* @param targets 识别结果
* @return 绘制后的图片
*/
public RecognizeImageStreamResult drawImageToStream(String imgUrl, List<RecognizeTargetVo> targets) throws IOException, URISyntaxException {
public static RecognizeImageStreamResult drawImageToStream(String imgUrl, List<RecognizeTargetVo> targets) throws IOException, URISyntaxException {
// 1. 加载图片
URI uri = new URI(imgUrl);
BufferedImage image = ImageIO.read(uri.toURL());

View File

@ -50,7 +50,7 @@ public class RecognizerUtils {
.body(JSONUtil.toJsonStr(paramMap))
.execute()) {
if (!response.isOk()) {
log.error("{}{}", errorMsg, response.getStatus());
log.error("{}{}:路径为- {}", errorMsg, response.getStatus(), capUrl);
throw new ServiceException(errorMsg + response.getStatus());
}
String body = response.body();

View File

@ -13,7 +13,7 @@ import java.util.stream.Collectors;
@Getter
public enum RecognizerTypeEnum {
// WEARING_ALL("穿戴安全帽反光衣", "wearingall", "1"),
// WEARING_ALL("穿戴安全帽反光衣", "wearingall", "1"),
// NO_EQUIPMENT("没穿安全帽反光衣", "noequipment", "2"),
NO_HELMET("未戴安全帽", "nohelmet", "3"),
NO_VEST("未穿反光衣", "novest", "4"),