我已成功实施以下内容:
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"
);
现在我想获得面部属性,例如:
年龄、性别、面部毛发
问题一:
- 我现在正在导入FACE API 1.0,有更新版本吗?
- 我也在 IOS 上使用 FACE API,而在 Android 中我看不到在 IOS 中可以看到的属性,例如眼镜,为什么?
问题2:
我需要有关更改查询的帮助,以便它可以获取年龄、性别等属性。我试图改变
null // returnFaceAttributes: a string like "age, gender"
至
age,gender // returnFaceAttributes: a string like "age, gender"
or "Age, Gender" , or [age, gender] or [Age, Gender] with no luck.
从界面我看到:
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;
和
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";
}
};
我如何格式化这些参数以获取值?
问题 3:
我需要收集并处理从通话中收到的输出。返回的对象的变量是什么?比如检测到的人脸数量、年龄、性别?