add_face_blocks

This commit is contained in:
unknown
2025-09-02 17:14:01 +08:00
parent e93ad6ac87
commit 1d208f6d0c
4 changed files with 50 additions and 5 deletions

View File

@@ -6631,10 +6631,17 @@ function add_face(user_title, user_topic, user_content, user_style, title_style)
}
if(!lastPublishTime || new Date().getTime() - lastFacePublishTime >= interval)
{
// Aug 2025
if(min_index == -1)
{
publish(user_topic, JSON.stringify({id: min_index, status: (min_index==-1?0:1), name: "Unknown", isMouthOpen: isMouthOpen, faceProbability: resizedDetections[0].detection.score.toFixed(3), happy: resizedDetections[0].expressions.happy.toFixed(3), sad: resizedDetections[0].expressions.sad.toFixed(3), angry: resizedDetections[0].expressions.angry.toFixed(3), surprised: resizedDetections[0].expressions.surprised.toFixed(3), disgusted: resizedDetections[0].expressions.disgusted.toFixed(3), fearful: resizedDetections[0].expressions.fearful.toFixed(3)}))
itemdiv.trigger(MixIO.eventTags.FACE_RECOGNIZED, [min_index, (min_index==-1?0:1), "Unknown", isMouthOpen, resizedDetections[0].detection.score.toFixed(3), resizedDetections[0].expressions.happy.toFixed(3), resizedDetections[0].expressions.sad.toFixed(3), resizedDetections[0].expressions.angry.toFixed(3), resizedDetections[0].expressions.surprised.toFixed(3), resizedDetections[0].expressions.disgusted.toFixed(3), resizedDetections[0].expressions.fearful.toFixed(3)])
}
else
{
publish(user_topic, JSON.stringify({id: min_index, status: (min_index==-1?0:1), name: user_data[min_index]["name"], isMouthOpen: isMouthOpen, faceProbability: resizedDetections[0].detection.score.toFixed(3), happy: resizedDetections[0].expressions.happy.toFixed(3), sad: resizedDetections[0].expressions.sad.toFixed(3), angry: resizedDetections[0].expressions.angry.toFixed(3), surprised: resizedDetections[0].expressions.surprised.toFixed(3), disgusted: resizedDetections[0].expressions.disgusted.toFixed(3), fearful: resizedDetections[0].expressions.fearful.toFixed(3)}))
itemdiv.trigger(MixIO.eventTags.FACE_RECOGNIZED, [min_index, (min_index==-1?0:1), user_data[min_index]["name"], isMouthOpen, resizedDetections[0].detection.score.toFixed(3), resizedDetections[0].expressions.happy.toFixed(3), resizedDetections[0].expressions.sad.toFixed(3), resizedDetections[0].expressions.angry.toFixed(3), resizedDetections[0].expressions.surprised.toFixed(3), resizedDetections[0].expressions.disgusted.toFixed(3), resizedDetections[0].expressions.fearful.toFixed(3)])
}
lastFacePublishTime = new Date().getTime()
}
}