add_face_blocks
This commit is contained in:
11
js/MixIO.js
11
js/MixIO.js
@@ -86,13 +86,14 @@ var MixIO = {
|
||||
CAMERA: 17,
|
||||
MIC: 18,
|
||||
SELECT: 19,
|
||||
PIXEL: 20
|
||||
PIXEL: 20,
|
||||
FACE: 21
|
||||
},
|
||||
|
||||
oldTags: ["input_button", "input_slider", "input_keyboard", "input_controller", "input_rgb", "output_bulb", "output_text",
|
||||
"output_chart", "output_bar", "table", "output_dashboard", "output_map", "input_weather", "timer", "trigger", "ble", "camera", "input_mic", "tinydb", "pixel"
|
||||
"output_chart", "output_bar", "table", "output_dashboard", "output_map", "input_weather", "timer", "trigger", "ble", "camera", "input_mic", "tinydb", "pixel", "face"
|
||||
],
|
||||
zhcnTags: ["按键/开关", "滑杆", "文本输入", "摇杆手柄", "RGB色盘", "指示灯", "文本显示屏", "折线图表", "柱状图表", "数据表格", "仪表盘", "数据地图", "实时气象仪", "定时触发器", "条件触发器", "蓝牙转发器", "摄像头", "语音识别", "下拉选项", "点阵屏"],
|
||||
zhcnTags: ["按键/开关", "滑杆", "文本输入", "摇杆手柄", "RGB色盘", "指示灯", "文本显示屏", "折线图表", "柱状图表", "数据表格", "仪表盘", "数据地图", "实时气象仪", "定时触发器", "条件触发器", "蓝牙转发器", "摄像头", "语音识别", "下拉选项", "点阵屏", "人脸识别"],
|
||||
|
||||
/*合法的MixIO事件种类*/
|
||||
eventTags: {
|
||||
@@ -140,7 +141,9 @@ var MixIO = {
|
||||
|
||||
MIC_SENT: "1811",
|
||||
|
||||
SELECT_SENT: "1911"
|
||||
SELECT_SENT: "1911",
|
||||
|
||||
FACE_RECOGNIZED: "2111"
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user