I have succesfully implemented the below:
private FaceServiceClient faceServiceClient =
new FaceServiceRestClient("xxx", "yyy");
private void detectAndFrame(final Bitmap imageBitmap)
{
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
ByteArrayInputStream inputStream =
new ByteArrayInputStream(outputStream.toByteArray());
AsyncTask<InputStream, String, Face[]> detectTask =
new AsyncTask<InputStream, String, Face[]>() {
@Override
protected Face[] doInBackground(InputStream... params) {
try {
publishProgress("Detecting...");
Log.e("face", "detecting");
Face[] result = faceServiceClient.detect(
params[0],
false, // returnFaceId
false, // returnFaceLandmarks
null // returnFaceAttributes: a string like "age, gender"
);
Now I want to get the face attributes like :
Age,Gender,FacialHair
Question 1:
- I am importing FACE API 1.0 at the moment, is there any update version?
- I am using FACE API on IOS as well and in Android I do not see attributes I can see in IOS like glasses, why?
Question 2:
I need an help on changing the query so it can get attributes like Age,Gender. I tried to change
null // returnFaceAttributes: a string like "age, gender"
to
age,gender // returnFaceAttributes: a string like "age, gender"
or "Age, Gender" , or [age, gender] or [Age, Gender] with no luck.
From the interface I see:
public interface FaceServiceClient {
Face[] detect(String var1, boolean var2, boolean var3, FaceServiceClient.FaceAttributeType[] var4) throws ClientException, IOException;
Face[] detect(InputStream var1, boolean var2, boolean var3, FaceServiceClient.FaceAttributeType[] var4) throws ClientException, IOException;
and
public static enum FaceAttributeType {
Age {
public String toString() {
return "age";
}
},
Gender {
public String toString() {
return "gender";
}
},
FacialHair {
public String toString() {
return "facialHair";
}
},
Smile {
public String toString() {
return "smile";
}
},
HeadPose {
public String toString() {
return "headPose";
}
};
How I have to format those parameters to get the values ?
Question 3:
I need to gather and work the output I receive from the call. What are the variables of the object returned? Like number of faces detected, age, gender?