Android Question Face Detect

BeneBarros

Active Member
Licensed User
I am using the subroutines below to detect the faces of the image.
This is working perfectly.

I would like some help getting Euler_x, Euler_Y and Euler_Z.
Can someone help me?

B4X:
Private Sub GetMidPoint(Face As JavaObject) As Float()
    Dim vl(3) As Float
    Dim p As JavaObject
    p.InitializeNewInstance("android.graphics.PointF", Null)
    Face.RunMethod("getMidPoint", Array As Object(p))
    vl(0) = p.GetField("x") 
    vl(1) = p.GetField("y") 
    vl(2) = Face.RunMethod("eyesDistance", Null) 
    Return vl
End Sub

Private Sub PrepareFaceDetection(Width As Int, Height As Int, MaxNumberOfFaces As Int)
    Dim jo As JavaObject
    jo.InitializeStatic("android.graphics.Bitmap")
    mbmp = jo.RunMethod("createBitmap", Array As Object(Width, Height, "RGB_565"))
    Dim ar, Face As JavaObject
    ar.InitializeStatic("java.lang.reflect.Array")
    Face.InitializeStatic("android.media.FaceDetector$Face")
    faces = ar.RunMethod("newInstance", Array As Object(Face, MaxNumberOfFaces))
    faceDetector.InitializeNewInstance("android.media.FaceDetector", Array As Object(Width, Height, MaxNumberOfFaces))
End Sub

Sub FindFaces(bmp As Bitmap) As Int
    Dim destRect As Rect
    destRect.Initialize(0, 0, mbmp.Width, mbmp.Height)
    cvs.DrawBitmap(bmp, Null, destRect)
    Return faceDetector.RunMethod("findFaces", Array As Object(mbmp, faces))
End Sub
 

BeneBarros

Active Member
Licensed User
I added the methods below in the GetMidPoint
and I obtained the following resuiltado.
confidence factor ok ... returned 0.5115 ....
but pose always returns 0.0.
can it be my cell that does not support this function ???
I'll try another one.


ToastMessageShow(Face.RunMethod("confidence", Null),False)
Dim Euler_X = 0, Euler_Y = 1, Euler_Z = 2 As Int
ToastMessageShow(Face.RunMethod("pose", Array As Object(Euler_Y)), False)
 
Top