FaceDetector.detect() returns a sequence<DetectedObject> [1], but DetectedObject doesn't exist, and it should return DetectedFace instead [2,3]. DetectedFace is not used at the moment. FaceDetector goes around this issue by returning DOMRects directly [4]. [1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/shapedetection/FaceDetector.idl?q=FaceDetector.idl&sq=package:chromium&dr&l=13 [2] https://wicg.github.io/shape-detection-api/#face-detection-api [3] https://wicg.github.io/shape-detection-api/#face-detection [4] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp?dr&sq=package:chromium&l=60
Solution: make FaceDetector return a sequence<DetectedFace> instead. https://codereview.chromium.org/2564123003 Note that this will break examples and demos: where now we have: faceDetector.detect() .then((faces) => { for(var i = 0; i < faces.length; i++) { console.log( '(' + faces[i].x + ',' + faces[i].y + '), size ' + faces[i].width + 'x' + faces[i].height + '</li>'); } }); Now we should do: faceDetector.detect() .then((faces) => { for(var i = 0; i < faces.length; i++) { const boundingBox = faces[i].boundingBox; // !!!! console.log( '(' + boundingBox.x + ',' + boundingBox.y + '), size ' + boundingBox.width + 'x' + boundingBox.height + '</li>'); } }); Essentially doing what we do for barcode detection.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2 commit f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2 Author: mcasas <mcasas@chromium.org> Date: Sun Dec 11 17:41:04 2016 Face Detection: Use DetectedFace in FaceDetector.cpp iso DOMRect FaceDetector.detect() in ToT returns a sequence<DetectedObject>, but DetectedObject doesn't exist, and it should return DetectedFace instead according to the Spec. Also, DetectedFace is not used at the moment (FaceDetector goes around this issue by returning DOMRects directly). This CL sorts that out by returning DetectedFaces directly. BUG= 673075 Review-Url: https://codereview.chromium.org/2564123003 Cr-Commit-Position: refs/heads/master@{#437794} [modify] https://crrev.com/f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2/content/test/data/media/face_detection_test.html [modify] https://crrev.com/f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2/third_party/WebKit/Source/modules/shapedetection/DetectedBarcode.h [modify] https://crrev.com/f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2/third_party/WebKit/Source/modules/shapedetection/DetectedFace.cpp [modify] https://crrev.com/f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2/third_party/WebKit/Source/modules/shapedetection/DetectedFace.h [modify] https://crrev.com/f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2/third_party/WebKit/Source/modules/shapedetection/DetectedFace.idl [modify] https://crrev.com/f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp [modify] https://crrev.com/f1f5959ffc84ab6069c0a1b4cd0c784b24c996d2/third_party/WebKit/Source/modules/shapedetection/FaceDetector.idl
Comment 1 by mcasas@chromium.org
, Dec 10 2016