Detect faces and is not just for Google Images. Now you can implement it on your website using Javascript and the canvas properties.
How it works?
To do this we need to work only 2 files in our <head />
<script type="text/javascript" src="dat.js"></script> <script type="text/javascript" src="detector.js"></script> |
Dat.js the file shows how to detect and detector.js the file has the logic of the script can detect faces in any photo.
1 can detect faces in the photos, the process becomes slower depending on what we choose (of course).
1 Face
face_detect_one( document.getElementById("myCanvas") ); |
Multiple Faces
face_detect_multi( document.getElementById("myCanvas") , progress_callback, result_callback ); function progress_callback( StepsCompleted, TotalSteps){ .... } |
Answer
The response functions that returns the values we obtain a rectangle that contains the person’s face.
var myCanvas = document.getElementById("mycanvas"); var result = face_detect_one( myCanvas ); if (result) draw_rect(result, myCanvas); function draw_rect(r, myCanvas){ var CanvasContext = myCanvas.getContext("2d"); CanvasContext.strokeRect( r.x, r.y, r.w, r.w ); } |
Link: via Percobaan





