Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 </head> | |
| 5 | |
| 6 <body> | |
| 7 <img id="myImage"> | |
| 8 </body> | |
| 9 | |
| 10 <script> | |
| 11 var img = document.getElementById("myImage"); | |
| 12 | |
| 13 function detectFacesOnImageUrl(url) { | |
|
mcasas
2016/10/18 23:15:14
This code, and the content_browsertest, seem to be
xianglu
2016/10/19 23:26:10
Face detection implementation in Java will return
mcasas
2016/10/19 23:41:11
Hmm I guess in that case, no comment is needed,
si
| |
| 14 img.src = url; | |
| 15 img.onload = function() { | |
| 16 var detector = new FaceDetector(); | |
| 17 var results = ""; | |
| 18 detector.detect(img) | |
| 19 .then(faceDetectionResult => { | |
|
mcasas
2016/10/18 23:15:13
micro-nit: s/faceDetectionResult/detectedFaces/ ?
xianglu
2016/10/19 23:26:10
Done.
| |
| 20 for (var i=0; i<faceDetectionResult.length; i++) { | |
| 21 var boundingBox = faceDetectionResult[i]; | |
|
mcasas
2016/10/18 23:15:14
const?
xianglu
2016/10/19 23:26:10
If I understand correctly, const in javascript mea
| |
| 22 var result = "x=" + boundingBox.x + ",y=" + boundingBox.y + | |
| 23 ",w=" + boundingBox.width + ",h=" + boundingBox.height; | |
| 24 results += result + "#"; | |
| 25 } | |
| 26 window.domAutomationController.send(results); | |
| 27 }) | |
| 28 .catch(error => { | |
| 29 var error = new Error("Error during detection:" + error); | |
| 30 window.domAutomationController.send(error.stack); | |
| 31 }); | |
| 32 | |
|
mcasas
2016/10/18 23:15:14
Remove this empty line?
xianglu
2016/10/19 23:26:10
Done.
| |
| 33 } | |
| 34 } | |
| 35 </script> | |
| 36 </html> | |
| OLD | NEW |