Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Diagnostics = require('Diagnostics');
- const FaceGestures = require('FaceGestures');
- const FaceTracking = require('FaceTracking');
- const Reactive = require('Reactive');
- const Scene = require('Scene');
- const Patches = require('Patches');
- var Left_Score = Patches.getScalarValue("Left_Num");
- var Right_Score = Patches.getScalarValue("Right_Num");
- // Locate the Left Number in the Scene
- const left_Number = Scene.root.find('Left_Num');
- // Locate the Right Number in the Scene
- const right_Number = Scene.root.find('Right_Num');
- // Store a reference to a detected face
- const face = FaceTracking.face(0);
- // Store references for when the left and right eye are closed
- const hasLeftEyeClosed = FaceGestures.hasLeftEyeClosed(face);
- const hasRightEyeClosed = FaceGestures.hasRightEyeClosed(face);
- // Register a blink event
- const winkingLeft = hasLeftEyeClosed;
- const winkingRight = hasRightEyeClosed;
- let Left_Eye_Num = 0;
- Patches.getScalarValue("Left_Num").monitor().subscribe(()=>{
- Scene.root.find(Patches.getStringValue("Left_Blink").pinLastValue()).text = Left_Score.toString();
- if(winkingLeft){
- Diagnostics.log("left face");
- }
- });
- Patches.getScalarValue("Right_Num").monitor().subscribe(()=>{
- Scene.root.find(Patches.getStringValue("Right_Blink").pinLastValue()).text = Right_Score.toString();
- if(winkingRight){
- Diagnostics.log("right face");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement