/* (0) check whether we're already running face detection */ return; // if yes, then do not initialize everything again /* (1) prepare the pico.js face detector */ var update_memory = pico.instantiate_detection_memory(5); // we will use the detecions of the last 5 frames /* (2) get the drawing context on the canvas and define a function to transform an RGBA image to grayscale */ // gray = 0.2*red + 0.7*green + 0.1*blue /* (3) this function is called each time a video frame becomes available */ // render the video frame to the canvas element and extract RGBA pixel data // prepare input to `run_cascade` "shiftfactor": 0.1, // move the detection window by 10% of its size "minsize": 100, // minimum size of a face "maxsize": 1000, // maximum size of a face "scalefactor": 1.1 // for multiscale processing: resize the detection window by 10% when moving to the higher scale // run the cascade over the frame and cluster the obtained detections // dets is an array that contains (r, c, s, q) quadruplets // (representing row, column, scale and detection score) dets = pico.cluster_detections(dets, 0.2); // set IoU threshold to 0.2 // draw detections // check the detection score // if it's above the threshold, draw it // (the constant 50.0 is empirical: other cascades might require a different one) /* (4) instantiate camera handling (see https://github.com/cbrandolino/camvas) */ /* (5) it seems that everything went well */

Heart Rate

Respiratory Rate

Heart Rate is >>

Respiratory Rate is >>