|
|
|
@@ -82,9 +82,11 @@ public class FaceChatMode { |
|
|
|
if(mUndeterminedPersons.containsKey(person.trackId)){ |
|
|
|
PersonInfo origin = mUndeterminedPersons.get(person.trackId); |
|
|
|
origin.updateTime = System.currentTimeMillis(); |
|
|
|
origin.result = person.result; |
|
|
|
origin.faceWidth = person.faceWidth; |
|
|
|
origin.bitmap = person.bitmap; |
|
|
|
if(person.result.hd_fa > 0 && person.result.fa_quality > origin.result.fa_quality){ |
|
|
|
origin.result = person.result; |
|
|
|
origin.faceWidth = person.faceWidth; |
|
|
|
origin.bitmap = person.bitmap; |
|
|
|
} |
|
|
|
mUndeterminedPersons.put(person.trackId, origin); |
|
|
|
} else{ |
|
|
|
mUndeterminedPersons.put(person.trackId, person); |
|
|
|
@@ -94,9 +96,11 @@ public class FaceChatMode { |
|
|
|
if(mPersons.containsKey(person.id)){ |
|
|
|
PersonInfo origin = mPersons.get(person.id); |
|
|
|
origin.updateTime = System.currentTimeMillis(); |
|
|
|
origin.result = person.result; |
|
|
|
origin.faceWidth = person.faceWidth; |
|
|
|
origin.bitmap = person.bitmap; |
|
|
|
if(person.result.hd_fa > 0 && person.result.fa_quality > origin.result.fa_quality){ |
|
|
|
origin.result = person.result; |
|
|
|
origin.faceWidth = person.faceWidth; |
|
|
|
origin.bitmap = person.bitmap; |
|
|
|
} |
|
|
|
mPersons.put(person.id, origin); |
|
|
|
} else{ |
|
|
|
mPersons.put(person.id, person); |
|
|
|
@@ -109,11 +113,8 @@ public class FaceChatMode { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(System.currentTimeMillis() - mInterval < 1000){ |
|
|
|
return false; |
|
|
|
} |
|
|
|
Logger.e("djTtsTime-收集数据结束:" + System.currentTimeMillis()); |
|
|
|
// sendStrangerToServer(); |
|
|
|
mInterval = System.currentTimeMillis(); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -123,7 +124,7 @@ public class FaceChatMode { |
|
|
|
filterUndeterminedFace(results, textureBitmap); |
|
|
|
} |
|
|
|
|
|
|
|
public static void confirmCurrentPerson(Bitmap textureBitmap){ |
|
|
|
public static void confirmCurrentPerson(){ |
|
|
|
if(mPersons.size() == 0 && mUndeterminedPersons.size() == 0){ |
|
|
|
return; |
|
|
|
} |
|
|
|
@@ -133,11 +134,11 @@ public class FaceChatMode { |
|
|
|
if(mUndeterminedPersons.size() > 0){ |
|
|
|
//选择未确定脸大的人 |
|
|
|
mSelectPerson = selectUnknownMaxFacePerson(mUndeterminedPersons); |
|
|
|
sendMsgAndLog(textureBitmap); |
|
|
|
sendMsgAndLog(); |
|
|
|
} |
|
|
|
return; |
|
|
|
} else{ |
|
|
|
mSelectPerson = selectKnownMaxTagAndFacePerson(); |
|
|
|
sendMsgAndLog(); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
@@ -169,13 +170,12 @@ public class FaceChatMode { |
|
|
|
int maxTag = selectPersonMaxTag(candidatesKnown); |
|
|
|
mSelectPerson = filterHighLevelAndMaxFacePerson(candidatesKnown, maxTag); |
|
|
|
} |
|
|
|
sendMsgAndLog(textureBitmap); |
|
|
|
sendMsgAndLog(); |
|
|
|
} |
|
|
|
|
|
|
|
private static PersonInfo selectKnownMaxTagAndFacePerson(){ |
|
|
|
int maxTag = selectPersonMaxTag(mPersons); |
|
|
|
return filterHighLevelAndMaxFacePerson(mPersons, maxTag); |
|
|
|
// sendMsgAndLog(textureBitmap); |
|
|
|
} |
|
|
|
|
|
|
|
private static List<PersonInfo> mCandidates = new ArrayList<>(); |
|
|
|
@@ -260,9 +260,11 @@ public class FaceChatMode { |
|
|
|
PersonInfo value = entry.getValue(); |
|
|
|
if (att.track_id == value.trackId) { |
|
|
|
value.updateTime = System.currentTimeMillis(); |
|
|
|
value.faceWidth = att.fa_w; |
|
|
|
value.result = att; |
|
|
|
value.bitmap = textureBitmap; |
|
|
|
if(att.hd_fa > 0 && att.fa_quality > value.result.fa_quality){ |
|
|
|
value.faceWidth = att.fa_w; |
|
|
|
value.result = att; |
|
|
|
value.bitmap = textureBitmap; |
|
|
|
} |
|
|
|
mPersons.put(key, value); |
|
|
|
it.remove(); |
|
|
|
} |
|
|
|
@@ -303,9 +305,11 @@ public class FaceChatMode { |
|
|
|
PersonInfo stranger = mUndeterminedPersons.get(att.track_id); |
|
|
|
if(stranger.id.equals("-2")){ |
|
|
|
stranger.updateTime = System.currentTimeMillis(); |
|
|
|
stranger.faceWidth = att.fa_w; |
|
|
|
stranger.result = att; |
|
|
|
stranger.bitmap = textureBitmap; |
|
|
|
if(att.hd_fa > 0 && att.fa_quality > stranger.result.fa_quality){ |
|
|
|
stranger.faceWidth = att.fa_w; |
|
|
|
stranger.result = att; |
|
|
|
stranger.bitmap = textureBitmap; |
|
|
|
} |
|
|
|
mUndeterminedPersons.put(att.track_id, stranger); |
|
|
|
it.remove(); |
|
|
|
return; |
|
|
|
@@ -318,17 +322,18 @@ public class FaceChatMode { |
|
|
|
message.name = ""; |
|
|
|
message.tag = "6"; |
|
|
|
message.trackId = att.track_id; |
|
|
|
message.startTime = System.currentTimeMillis(); |
|
|
|
message.result = att; |
|
|
|
message.faceWidth = att.fa_w; |
|
|
|
message.bitmap = textureBitmap; |
|
|
|
mUndeterminedPersons.put(att.track_id, message); |
|
|
|
} else{ |
|
|
|
PersonInfo message = mUndeterminedPersons.get(att.track_id); |
|
|
|
message.updateTime = System.currentTimeMillis(); |
|
|
|
message.faceWidth = att.fa_w; |
|
|
|
message.result = att; |
|
|
|
message.bitmap = textureBitmap; |
|
|
|
message.updateTime = System.currentTimeMillis(); |
|
|
|
if(att.hd_fa > 0 && att.fa_quality > message.result.fa_quality){ |
|
|
|
message.faceWidth = att.fa_w; |
|
|
|
message.result = att; |
|
|
|
message.bitmap = textureBitmap; |
|
|
|
} |
|
|
|
mUndeterminedPersons.put(att.track_id, message); |
|
|
|
} |
|
|
|
it.remove(); |
|
|
|
@@ -403,7 +408,7 @@ public class FaceChatMode { |
|
|
|
private static String lastUserID; |
|
|
|
private static long nextLogTime; |
|
|
|
|
|
|
|
private static void sendMsgAndLog(Bitmap textureBitmap){ |
|
|
|
private static void sendMsgAndLog(){ |
|
|
|
if(mSelectPerson == null){ |
|
|
|
return; |
|
|
|
} |
|
|
|
@@ -418,12 +423,12 @@ public class FaceChatMode { |
|
|
|
if (!sendId.equals(lastUserID)) { |
|
|
|
lastUserID = sendId; |
|
|
|
nextLogTime = System.currentTimeMillis(); |
|
|
|
sendLog(isStranger, sendId, mSelectPerson.tag, (mSelectPerson.score), BmpCompressUtils.getBytesByBitmap(Utils.CompressBmp(textureBitmap, mSelectPerson.result), 50, Bitmap.CompressFormat.JPEG)); |
|
|
|
sendLog(isStranger, sendId, mSelectPerson.tag, (mSelectPerson.score), BmpCompressUtils.getBytesByBitmap(Utils.CompressBmp(mSelectPerson.bitmap, mSelectPerson.result), 50, Bitmap.CompressFormat.JPEG)); |
|
|
|
} else { |
|
|
|
if (System.currentTimeMillis() - nextLogTime > 60000) { |
|
|
|
lastUserID = sendId; |
|
|
|
nextLogTime = System.currentTimeMillis(); |
|
|
|
sendLog(isStranger, sendId, mSelectPerson.tag, (mSelectPerson.score), BmpCompressUtils.getBytesByBitmap(Utils.CompressBmp(textureBitmap, mSelectPerson.result), 50, Bitmap.CompressFormat.JPEG)); |
|
|
|
sendLog(isStranger, sendId, mSelectPerson.tag, (mSelectPerson.score), BmpCompressUtils.getBytesByBitmap(Utils.CompressBmp(mSelectPerson.bitmap, mSelectPerson.result), 50, Bitmap.CompressFormat.JPEG)); |
|
|
|
} |
|
|
|
} |
|
|
|
sendStrangerToServer(); |
|
|
|
@@ -459,7 +464,7 @@ public class FaceChatMode { |
|
|
|
name = !TextUtils.isEmpty(emp.nickName) ? emp.nickName : emp.name; //两个名称都传给H5 |
|
|
|
gender = emp.gender == 0 ? (int) result.bd_gender : emp.gender; |
|
|
|
tag = emp.typeId +""; |
|
|
|
// Logger.e(TAG, "------------识别到人:" + name + "-------------"); |
|
|
|
Logger.e("djTtsTime-识别到人:" + name + "-------------"); |
|
|
|
Set<String> strings = Utils.userLogs.keySet(); |
|
|
|
if (strings.contains(id)) { |
|
|
|
times = 1; |
|
|
|
@@ -544,7 +549,8 @@ public class FaceChatMode { |
|
|
|
SimpleDateFormat spTime = new SimpleDateFormat("yyyy-MM-dd/HH:mm:ss");//yyyy-MM-dd/HH:mm:ss HH24 hh12 |
|
|
|
String sT = spTime.format(date); |
|
|
|
String sendingMsg = obj.toString(); |
|
|
|
Logger.e(sT + ":发送消息到H5: " + sendingMsg + "/"); |
|
|
|
// Logger.e(sT + ":发送消息到H5: " + sendingMsg + "/"); |
|
|
|
Logger.e("djTtsTime-给H5发消息打招呼:" + System.currentTimeMillis()); |
|
|
|
MessageUtils.sendMessage(sendingMsg); |
|
|
|
} catch (JSONException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
@@ -833,7 +839,7 @@ public class FaceChatMode { |
|
|
|
postParam.put("staffBase64Img", base64); |
|
|
|
MessageUtils.sendAsrText("调用接口"); |
|
|
|
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), new JSONObject(postParam).toString()); |
|
|
|
HttpUtil.post(Config.DEV_BASE_URL + "system/staff/api/new-staff", requestBody, null, new HttpUtil.HttpCallback<String>() { |
|
|
|
HttpUtil.post(Config.CURRENT_URL + "system/staff/api/new-staff", requestBody, null, new HttpUtil.HttpCallback<String>() { |
|
|
|
@Override |
|
|
|
public void onSuccess(String success) { |
|
|
|
try { |
|
|
|
|