diff --git a/Blazeface_20201012/blazeface.js b/Blazeface_20201012/blazeface.js
index 1837d0ae96..12c47662ed 100644
--- a/Blazeface_20201012/blazeface.js
+++ b/Blazeface_20201012/blazeface.js
@@ -104,6 +104,13 @@
document.getElementById("sourceId_blazeface").innerHTML = "gameimage_blazeface";
}
}
+
+ function blazeface_clear() {
+ document.getElementById("gamediv_blazeface").innerHTML = "";
+ }
+
+ function blazeface_recognitionFinish() {
+ }
window.blazeface_video = blazeface_video;
window.blazeface_get = blazeface_get;
@@ -111,5 +118,7 @@
window.blazeface_state = blazeface_state;
window.blazeface_startvideo_media = blazeface_startvideo_media;
window.blazeface_startvideo_stream = blazeface_startvideo_stream;
+ window.blazeface_clear = blazeface_clear;
+ window.blazeface_recognitionFinish = blazeface_recognitionFinish;
}(window, window.document));
diff --git a/Blazeface_20201012/blazeface_video.js b/Blazeface_20201012/blazeface_video.js
index 2cc2426be8..a2d50da0ea 100644
--- a/Blazeface_20201012/blazeface_video.js
+++ b/Blazeface_20201012/blazeface_video.js
@@ -48,16 +48,15 @@ window.onload = function () {
context.drawImage(obj, 0, 0, obj.width, obj.height);
if (blazefaceState.innerHTML=="0") {
- result.innerHTML = "";
+ //result.innerHTML = "";
setTimeout(function(){DetectVideo(obj);}, 100);
return;
}
const returnTensors = false;
await Model.estimateFaces(canvas, returnTensors).then(predictions => {
- result.innerHTML = "";
+
var scoreLimit = Number(document.getElementById("scorelimit_blazeface").value);
-
//console.log(predictions.score);
//console.log(predictions.keypoints);
result.innerHTML = "";
@@ -89,7 +88,7 @@ window.onload = function () {
}
if (result.innerHTML!="") {
result.innerHTML = result.innerHTML.substr(0,result.innerHTML.length-4);
- if (typeof recognitionFinish === 'function') recognitionFinish();
+ if (typeof blazeface_recognitionFinish === 'function') blazeface_recognitionFinish();
}
}
diff --git a/Blazeface_20201012/blockly.json b/Blazeface_20201012/blockly.json
index f2f5e8ed62..e63b1990e8 100644
--- a/Blazeface_20201012/blockly.json
+++ b/Blazeface_20201012/blockly.json
@@ -1,5 +1,5 @@
{
- "types": ["blazeface_video","blazeface_person","blazeface_state","blazeface_video_position","blazeface_startvideo_media","blazeface_startvideo_stream"],
+ "types": ["blazeface_video","blazeface_person","blazeface_state","blazeface_video_position","blazeface_startvideo_media","blazeface_startvideo_stream", "blazeface_clear", "blazeface_pause", "blazeface_recognitied"],
"category": "catPlus",
"scripts": [
"blockly/blocks.js",
diff --git a/Blazeface_20201012/blockly/blocks.js b/Blazeface_20201012/blockly/blocks.js
index 0dca223ffd..b7409ae9f9 100644
--- a/Blazeface_20201012/blockly/blocks.js
+++ b/Blazeface_20201012/blockly/blocks.js
@@ -148,3 +148,40 @@ Blockly.Blocks['blazeface_startvideo_stream'] = {
this.setColour(60);
}
};
+
+Blockly.Blocks['blazeface_clear'] = {
+ init: function() {
+ this.appendDummyInput()
+ .appendField(Blockly.Msg.BLAZEFACE_CLEAR_SHOW);
+ this.setInputsInline(true);
+ this.setPreviousStatement(true);
+ this.setNextStatement(true);
+ this.setColour(60);
+ }
+};
+
+Blockly.Blocks['blazeface_pause'] = {
+ init: function() {
+ this.appendDummyInput()
+ .appendField(Blockly.Msg.BLAZEFACE_PAUSE_SHOW);
+ this.appendValueInput("time_")
+ .setCheck("Number")
+ .appendField("(ms)");
+ this.setInputsInline(true);
+ this.setPreviousStatement(true);
+ this.setNextStatement(true);
+ this.setColour(60);
+ }
+};
+
+Blockly.Blocks['blazeface_recognitied'] = {
+ init: function () {
+ this.appendDummyInput()
+ .appendField(Blockly.Msg.BLAZEFACE_RECOGNITIED_SHOW);
+ this.appendStatementInput("do_");
+ this.setInputsInline(true);
+ this.setPreviousStatement(true);
+ this.setNextStatement(true);
+ this.setColour(60);
+ }
+};
\ No newline at end of file
diff --git a/Blazeface_20201012/blockly/javascript.js b/Blazeface_20201012/blockly/javascript.js
index 2582abdfef..72cdff0255 100644
--- a/Blazeface_20201012/blockly/javascript.js
+++ b/Blazeface_20201012/blockly/javascript.js
@@ -41,4 +41,21 @@ Blockly.JavaScript['blazeface_startvideo_stream'] = function(block) {
var value_src_ = Blockly.JavaScript.valueToCode(block, 'src_', Blockly.JavaScript.ORDER_ATOMIC);
var code = 'blazeface_startvideo_stream(' + value_src_ + ');\n';
return code;
+};
+
+Blockly.JavaScript['blazeface_clear'] = function(block) {
+ var code = 'blazeface_clear();\n';
+ return code;
+};
+
+Blockly.JavaScript['blazeface_pause'] = function(block) {
+ var value_time = Blockly.JavaScript.valueToCode(block, 'time_', Blockly.JavaScript.ORDER_ATOMIC);
+ var code = 'blazeface_state(0);setTimeout(function(){blazeface_state(1);}, '+value_time+');\n';
+ return code;
+};
+
+Blockly.JavaScript['blazeface_recognitied'] = function(block) {
+ var statements_do = Blockly.JavaScript.statementToCode(block, 'do_');
+ var code = 'blazeface_recognitionFinish = async function() {\nblazeface_state(0);\n' + statements_do + '\nblazeface_state(1);};\n';
+ return code;
};
\ No newline at end of file
diff --git a/Blazeface_20201012/blockly/msg/blocks/en.js b/Blazeface_20201012/blockly/msg/blocks/en.js
index c116843292..7df5e4c371 100644
--- a/Blazeface_20201012/blockly/msg/blocks/en.js
+++ b/Blazeface_20201012/blockly/msg/blocks/en.js
@@ -14,4 +14,7 @@ Blockly.Msg.BLAZEFACE_FRAME_SHOW = "Frame";
Blockly.Msg.BLAZEFACE_FACING_SHOW = "Camera Facing";
Blockly.Msg.BLAZEFACE_FACING_FRONT_SHOW = "Front";
Blockly.Msg.BLAZEFACE_FACING_BACK_SHOW = "Back";
-Blockly.Msg.BLAZEFACE_SRC_SHOW = "Stream URL";
\ No newline at end of file
+Blockly.Msg.BLAZEFACE_SRC_SHOW = "Stream URL";
+Blockly.Msg.BLAZEFACE_CLEAR_SHOW = "Face Detection (blazeface) clear result";
+Blockly.Msg.BLAZEFACE_PAUSE_SHOW = "Face Detection (blazeface) Pause";
+Blockly.Msg.BLAZEFACE_RECOGNITIED_SHOW = "Face Detection (blazeface) recognitied";
\ No newline at end of file
diff --git a/Blazeface_20201012/blockly/msg/blocks/zh-hans.js b/Blazeface_20201012/blockly/msg/blocks/zh-hans.js
index cc57c097a5..96b8b10222 100644
--- a/Blazeface_20201012/blockly/msg/blocks/zh-hans.js
+++ b/Blazeface_20201012/blockly/msg/blocks/zh-hans.js
@@ -14,4 +14,7 @@ Blockly.Msg.BLAZEFACE_FRAME_SHOW = "框架";
Blockly.Msg.BLAZEFACE_FACING_SHOW = "镜头";
Blockly.Msg.BLAZEFACE_FACING_FRONT_SHOW = "前置";
Blockly.Msg.BLAZEFACE_FACING_BACK_SHOW = "后置";
-Blockly.Msg.BLAZEFACE_SRC_SHOW = "串流网址";
\ No newline at end of file
+Blockly.Msg.BLAZEFACE_SRC_SHOW = "串流网址";
+Blockly.Msg.BLAZEFACE_CLEAR_SHOW = "脸部侦测 (blazeface) 清除结果";
+Blockly.Msg.BLAZEFACE_PAUSE_SHOW = "脸部侦测 (blazeface) 暂停侦测";
+Blockly.Msg.BLAZEFACE_RECOGNITIED_SHOW = "脸部侦测 (blazeface) 侦测完成后执行";
\ No newline at end of file
diff --git a/Blazeface_20201012/blockly/msg/blocks/zh-hant.js b/Blazeface_20201012/blockly/msg/blocks/zh-hant.js
index e8701892b3..22fd601226 100644
--- a/Blazeface_20201012/blockly/msg/blocks/zh-hant.js
+++ b/Blazeface_20201012/blockly/msg/blocks/zh-hant.js
@@ -14,4 +14,7 @@ Blockly.Msg.BLAZEFACE_FRAME_SHOW = "框架";
Blockly.Msg.BLAZEFACE_FACING_SHOW = "鏡頭";
Blockly.Msg.BLAZEFACE_FACING_FRONT_SHOW = "前置";
Blockly.Msg.BLAZEFACE_FACING_BACK_SHOW = "後置";
-Blockly.Msg.BLAZEFACE_SRC_SHOW = "串流網址";
\ No newline at end of file
+Blockly.Msg.BLAZEFACE_SRC_SHOW = "串流網址";
+Blockly.Msg.BLAZEFACE_CLEAR_SHOW = "臉部偵測 (blazeface) 清除結果";
+Blockly.Msg.BLAZEFACE_PAUSE_SHOW = "臉部偵測 (blazeface) 暫停偵測";
+Blockly.Msg.BLAZEFACE_RECOGNITIED_SHOW = "臉部偵測 (blazeface) 偵測完成後執行";
\ No newline at end of file
diff --git a/Blazeface_20201012/blockly/toolbox.xml b/Blazeface_20201012/blockly/toolbox.xml
index 30b3e1d089..ae3325149b 100644
--- a/Blazeface_20201012/blockly/toolbox.xml
+++ b/Blazeface_20201012/blockly/toolbox.xml
@@ -24,7 +24,9 @@
http://192.168.***.***:81/stream
-
+
+
+
@@ -34,6 +36,8 @@
+
+
@@ -45,5 +49,12 @@
0
-
+
+
+
+
+ 1000
+
+
+