类 FaceUtils
- java.lang.Object
-
- cn.smartjavaai.face.utils.FaceUtils
-
public class FaceUtils extends Object
人脸检测相关工具类- 作者:
- dwj
-
-
构造器概要
构造器 构造器 说明 FaceUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static DetectionResponseconvertToDetectionResponse(ai.djl.modality.cv.output.DetectedObjects detection, ai.djl.modality.cv.Image img)转换为FaceDetectedResultstatic DetectionResponseconvertToDetectionResponse(com.seeta.sdk.SeetaRect[] seetaResult, FaceModelConfig config, List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList)转换为FaceDetectedResultstatic DetectionResponseconvertToDetectionResponse(com.seeta.sdk.SeetaRect[] seetaResult, List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList, List<LivenessStatus> livenessStatusList)转换为FaceDetectedResultstatic EyeStatusconvertToEyeStatus(com.seeta.sdk.EyeStateDetector.EYE_STATE eyeState)转为EyeStatusstatic DetectionResponseconvertToFaceAttributeResponse(com.seeta.sdk.SeetaRect[] seetaResult, List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList, List<FaceAttribute> faceAttributeList)static GenderTypeconvertToGenderType(com.seeta.sdk.GenderPredictor.GENDER gender)转为GenderTypestatic LivenessStatusconvertToLivenessStatus(com.seeta.sdk.FaceAntiSpoofing.Status status)将SeetaAntiSpoofing.Status转换为LivenessStatusstatic com.seeta.sdk.SeetaPointF[]convertToSeetaPointF(List<Point> pointList)将PointList转换为SeetaPointF[]static com.seeta.sdk.SeetaRectconvertToSeetaRect(DetectionRectangle detectionRectangle)将DetectionRectangle转换为SeetaRectstatic DetectionRectanglecorrectRect(DetectionRectangle rectangle, int imageWidth, int imageHeight)修正检测框static BufferedImagedrawBoundingBoxes(BufferedImage sourceImage, DetectionResponse detectionResponse)绘制人脸框static voiddrawBoundingBoxes(BufferedImage sourceImage, DetectionResponse detectionResponse, String savePath)绘制人脸框static voiddrawBoxesWithFaceAttribute(BufferedImage sourceImage, DetectionResponse detectionResponse, String savePath)绘制人脸属性static double[][]facePoints(com.seeta.sdk.SeetaPointF[] pointFS)子图中人脸关键点坐标 - Coordinates of key points in the imagestatic double[][]facePoints(List<Point> points)子图中人脸关键点坐标 - Coordinates of key points in the imagestatic ai.djl.ndarray.NDArrayfaceTemplate512x512(ai.djl.ndarray.NDManager manager)512x512的目标点 - Target point of 512x512 standard 5 landmarks for FFHQ faces with 512 x 512static BufferedImagetoBufferedImage(com.seeta.sdk.SeetaImageData seetaImageData)bgr转图片
-
-
-
方法详细资料
-
convertToDetectionResponse
public static DetectionResponse convertToDetectionResponse(ai.djl.modality.cv.output.DetectedObjects detection, ai.djl.modality.cv.Image img)
转换为FaceDetectedResult- 参数:
detection-img-- 返回:
-
convertToDetectionResponse
public static DetectionResponse convertToDetectionResponse(com.seeta.sdk.SeetaRect[] seetaResult, FaceModelConfig config, List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList)
转换为FaceDetectedResult- 参数:
seetaResult-- 返回:
-
drawBoundingBoxes
public static void drawBoundingBoxes(BufferedImage sourceImage, DetectionResponse detectionResponse, String savePath) throws IOException
绘制人脸框- 参数:
sourceImage-detectionResponse-savePath-- 抛出:
IOException
-
drawBoundingBoxes
public static BufferedImage drawBoundingBoxes(BufferedImage sourceImage, DetectionResponse detectionResponse) throws IOException
绘制人脸框- 参数:
sourceImage-detectionResponse-- 抛出:
IOException
-
correctRect
public static DetectionRectangle correctRect(DetectionRectangle rectangle, int imageWidth, int imageHeight)
修正检测框- 参数:
rectangle-imageWidth-imageHeight-- 返回:
-
facePoints
public static double[][] facePoints(List<Point> points)
子图中人脸关键点坐标 - Coordinates of key points in the image- 参数:
points-- 返回:
-
facePoints
public static double[][] facePoints(com.seeta.sdk.SeetaPointF[] pointFS)
子图中人脸关键点坐标 - Coordinates of key points in the image- 参数:
pointFS-- 返回:
-
faceTemplate512x512
public static ai.djl.ndarray.NDArray faceTemplate512x512(ai.djl.ndarray.NDManager manager)
512x512的目标点 - Target point of 512x512 standard 5 landmarks for FFHQ faces with 512 x 512- 参数:
manager-- 返回:
-
toBufferedImage
public static BufferedImage toBufferedImage(com.seeta.sdk.SeetaImageData seetaImageData)
bgr转图片- 返回:
- 图片
-
convertToSeetaRect
public static com.seeta.sdk.SeetaRect convertToSeetaRect(DetectionRectangle detectionRectangle)
将DetectionRectangle转换为SeetaRect- 参数:
detectionRectangle-- 返回:
-
convertToSeetaPointF
public static com.seeta.sdk.SeetaPointF[] convertToSeetaPointF(List<Point> pointList)
将PointList转换为SeetaPointF[]- 参数:
pointList-- 返回:
-
convertToLivenessStatus
public static LivenessStatus convertToLivenessStatus(com.seeta.sdk.FaceAntiSpoofing.Status status)
将SeetaAntiSpoofing.Status转换为LivenessStatus- 参数:
status-- 返回:
-
convertToGenderType
public static GenderType convertToGenderType(com.seeta.sdk.GenderPredictor.GENDER gender)
转为GenderType- 参数:
gender-- 返回:
-
convertToEyeStatus
public static EyeStatus convertToEyeStatus(com.seeta.sdk.EyeStateDetector.EYE_STATE eyeState)
转为EyeStatus- 参数:
eyeState-- 返回:
-
convertToFaceAttributeResponse
public static DetectionResponse convertToFaceAttributeResponse(com.seeta.sdk.SeetaRect[] seetaResult, List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList, List<FaceAttribute> faceAttributeList)
-
convertToDetectionResponse
public static DetectionResponse convertToDetectionResponse(com.seeta.sdk.SeetaRect[] seetaResult, List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList, List<LivenessStatus> livenessStatusList)
转换为FaceDetectedResult- 参数:
seetaResult-- 返回:
-
drawBoxesWithFaceAttribute
public static void drawBoxesWithFaceAttribute(BufferedImage sourceImage, DetectionResponse detectionResponse, String savePath) throws IOException
绘制人脸属性- 参数:
sourceImage-detectionResponse-savePath-- 抛出:
IOException
-
-