同步操作将从 OAL/TengineKit 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
The located Function under com.tenginekit
.
AndroidConfig
is the config of work Face.init(Context context, AndroidConfig config);
For example, set the default configuration like this.
Face.init(context,
AndroidConfig
.create()
.setCameraMode()
.setDefaultFunc()
.setDefaultInputImageFormat()
.setInputImageSize(previewWidth, previewHeight)
.setOutputImageSize(OutputWidth, OutputHeight)
);
.create()
First create an AndroidConfig.
Configuration mode:
.setNormalMode()
Set to normal mode
.setCameraMode()
Set to camera mode(This mode will automatically rotate the picture according to the front and rear camera)
.setHandleMode(HandleMode mHandleMode)
Parameter transmission mode setting mode
public enum HandleMode{
Normal, // Normal mode
Camera // Camera mode
}
Configure input picture format:
.setDefaultInputImageFormat()
Set the default picture format (YUV_NV21)
.setInputImageFormat(ImageFormat imageFormat)
Parameter transmission mode to set input picture format
public enum ImageFormat
{
YUV_NV21,
RGB,
RGBA,
GRAY
}
Configure input and output:
.setInputImageSize(int w, int h)
Input width and height (preview_w, preview_h)
.setOutputImageSize()
Output width and height (display size)
Configuration function (functions are based on image detection):
.setDefaultFunc()
Set default functions (face detection and key points)
.openFunc(Func func)
Pass parameter setting function (image detection must be set toAndroidConfig.Func.Detect
orAndroidConfig.Func.BlazeFace
)
public enum Func
{
Detect,
Landmark,
Attribution,
BlazeFace,
FaceMesh,
}
Tips:BlazeFace, FaceMesh models are from Google,The project address is:https://github.com/google/mediapipe
Since all functions are based on face detection, first create an object of Face.FaceDetect
. Detect detection will be faster, BlazeFace will be more accurate and the angle can be larger (BlazeFace is based on the Google model). Will eventually return a FaceDetectInfo list;
Face.FaceDetect faceDetect = Face.detect(imageData);
List<FaceDetectInfo> faceDetectInfos = faceDetect.getDetectInfos();
The face key point function is based on face detection, so the landmark information acquisition method should be based on the Face.FaceDetect
object created earlier. Finally returns a FaceLandmarkInfo list;
List<LandmarkInfo> landmarkInfos = faceDetect.landmark2d();;
The face key point function is based on face detection, so the 3d landmark information acquisition method should be based on the Face.FaceDetect
object created earlier. Finally returns a FaceLandmark3dInfo list;
List<FaceLandmark3dInfo> landmarkInfos = faceDetect.landmark3d();;
The attribute function is based on face detection, so the method of obtaining attribute information is based on the Face.FaceDetect
object created earlier. Finally returns a FaceAttributionInfo list;
List<AttributionInfo> attributionInfos = faceDetect.attribution();
Switching cameras is only useful when in camera mode.
Face.Camera.switchCamera(boolean back);
Setting rotation is only useful in camera mode.
Face.Camera.setRotation(int ori, boolean isScreenRotate, int outputW, int outputH);
FaceManager.getInstance().release();
Parameter name | Parameter type | Comment |
---|---|---|
top | int | Distance display upper edge distance |
bottom | int | Distance display bottom edge distance |
left | int | Distance shows the distance of the left edge |
right | int | Distance display right edge distance |
width | int | Face rect width |
height | int | Face rect height |
.asRect()
is a method in FaceDetectInfo, which can directly return an object of class Rect
.
Parameter name | Parameter type | Comment |
---|---|---|
landmarks | List | Face key point information 212 points |
pitch | float | Human face pitch direction corner |
yaw | float | Human face yaw direction corner |
roll | float | Human face roll direction corner |
leftEyeClose | float | Left eye closure confidence 0~1 |
rightEyeClose | float | Right eye closure confidence 0~1 |
mouseClose | float | Mouth closure confidence 0~1 |
mouseOpenBig | float | Open mouth Big confidence 0~1 |
Parameter name | Parameter type | Comment |
---|---|---|
landmarks | List | Face key point information 468 points |
Parameter name | Parameter type | Comment |
---|---|---|
age | int | Age |
isMan | boolean | Is it male |
smile | int | Smile degree0~100 |
glasses | boolean | Whether to wear glasses |
beatyOfManLook | int | Face value from a male perspective |
beautyOfWomanLook | int | Face value from a female perspective |
Parameter name | Parameter type | Comment |
---|---|---|
x | float | Point x position |
y | float | Point y position |
synchronized static public Bitmap convertImage(Bitmap bitmap,
int inputX1, int inputY1, int inputX2, int inputY2,
int outputW, int outputH, int rotation, boolean mirror);
synchronized static public byte[] convertCameraYUVData(byte[] data,
AndroidConfig.ImageFormat imageOutputFormat,
int inputW, int inputH,
int outputW, int outputH, int rotation, boolean mirror
synchronized static public Bitmap convertCameraYUVData(byte[] data,
int inputW, int inputH,
int outputW, int outputH,
int rotation, boolean mirror
synchronized static public byte[] convertImage(byte[] data,
AndroidConfig.ImageFormat imageInputFormat, AndroidConfig.ImageFormat imageOutputFormat,
int inputW, int inputH,
int inputX1, int inputY1, int inputX2, int inputY2,
int outputW, int outputH, int rotation, boolean mirror
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。