The located Function under com.tenginekit.
val sdkConfig = SdkConfig()
TengineKitSdk.getInstance().initSdk(path, config, context)- backend: predict backend, cpu default now
TengineKitSdk.getInstance().initFaceDetect()We merge all the functions into one interface
val byte = ImageUtils.bitmap2RGB(bitmap)
val faceConfig = FaceConfig().apply {
detect = true
landmark2d = true
video = false
}
val imageConfig = ImageConfig().apply {
data = byte
degree = 0
mirror = false
height = bitmapHeight
width = bitmapWidth
format = ImageConfig.FaceImageFormat.RGB
}
val faces = TengineKitSdk.getInstance().detectFace(faceConfig, config) TengineKitSdk.getInstance().releaseFaceDetect() TengineKitSdk.getInstance().initInsightFace()We merge all the functions into one interface
val byte = ImageUtils.bitmap2RGB(bitmap)
val config = InsightFaceConfig().apply {
scrfd = true
recognition = true
registered = false
video = false
}
val imageConfig = ImageConfig().apply {
data = byte
degree = 0
mirror = false
height = it.height
width = it.width
format = ImageConfig.FaceImageFormat.RGB
}
val faces = TengineKitSdk.getInstance().detectInsightFace(imageConfig, config) TengineKitSdk.getInstance().releaseInsightFace() TengineKitSdk.getInstance().initSegBody()
directly return a mask, the mask is a android bitmap, the mask's width is 398, the height is 224; the mask's format is ARGB_8888
val byte = ImageUtils.bitmap2RGB(bitmap)
val config = SegConfig()
val imageConfig = ImageConfig().apply {
data = byte
degree = 0
mirror = false
height = it.height
width = it.width
format = ImageConfig.FaceImageFormat.RGB
}
val bitmapMask = TengineKitSdk.getInstance().segHuman(imageConfig, config) TengineKitSdk.getInstance().releaseSegBody()
TengineKitSdk.getInstance().initBodyDetect()We merge all the functions into one interface
val data = ImageUtils.bitmap2RGB(bitmap)
val imageConfig = ImageConfig().apply {
this.data = data
this.format = ImageConfig.FaceImageFormat.RGB
this.height = it.height
this.width = it.width
this.mirror = false
this.degree = 0
}
val bodyConfig = BodyConfig()
val bodyS = TengineKitSdk.getInstance().bodyDetect(imageConfig, bodyConfig) TengineKitSdk.getInstance().releaseBodyDetect() TengineKitSdk.getInstance().release()
- data(byte[]): set image data byte array of image raw data
- degree(int): set rotate degree need if in camera mode, need to rotate the right angle to detect the face
- width(int): set bitmap width or preview width
- height(int): set bitmap height or preview height
- format(enum ImageConfig.FaceImageFormat): set image format, support RGB format and NV21 format current now
- detect(boolean): set true if need detect face rect
- landmark2d(boolean): set true if need landmark2d except detect face rect
- video(boolean): set true if in camera mode
- scrfd(boolean): set true if need do scrfd
- recognition(boolean): set true if need do arcface
- registered(boolean): set true if already registered face
- default portrait segmentation config current
- landmark(boolean): set true if need body landmark
all detect values are normalized from 0 to 1
- x1: face rect left
- y1: face rect top
- x2: face rect right
- y2: face rect bottom
- landmark: if not null landmark contain 212 face key points
- headX: Human face pitch direction corner
- headY: Human face yaw direction corner
- headZ: Human face roll direction corner
- leftEyeClose: Left eye closure confidence 0~1
- rightEyeClose: Right eye closure confidence 0~1
- mouthClose: Mouth closure confidence 0~1
- mouthBigOpen: Open mouth Big confidence 0~1
- x1: detect body rect left
- y1: detect body rect top
- x2: detect body rect right
- y2: detect body rect bottom
- landmark: if not null landmark contain 5 face key points
- confidence: face detect confidence
- feature: if not null feature contain 512 face feature points
- x1: detect body rect left
- y1: detect body rect top
- x2: detect body rect right
- y2: detect body rect bottom
- landmark: if not null landmark contain 16 body key points