Implementation bug for the Shape Detection API.
https://www.chromestatus.com/features/4757990523535360 https://groups.google.com/a/chromium.org/d/msg/blink-dev/JkdoxpINjxQ/CUWOBwc0AgAJ
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a4f0895546f2d20906d5b276a9aafae9af50dd30 commit a4f0895546f2d20906d5b276a9aafae9af50dd30 Author: mcasas <mcasas@chromium.org> Date: Thu Oct 27 18:46:46 2016 ShapeDetection: support CanvasImageSource as detect() source This CL changes the input parameter to FaceDetector.detect() to be a CanvasImageSource, refactors the current code to handle HTMLImageElement inputs, and adds support for ImageBitmap. So now we'll have a single detect() method doing the common stuff and delegating the specifics to e.g. detectFacesOnImageElement(), detectFacesOnImageBitmap() etc. It also beefs up the corresponding LayoutTests, renaming some files/functions where appropriate BUG=659138 TEST=layout tests (fast, non fast, http). Review-Url: https://codereview.chromium.org/2448193002 Cr-Commit-Position: refs/heads/master@{#428094} [add] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-empty-input.html [modify] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-security-test.html [modify] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/LayoutTests/http/tests/shapedetection/shapedetection-cross-origin.html [rename] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/LayoutTests/shapedetection/detectface-HTMLImageElement.html [add] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/LayoutTests/shapedetection/detectface-ImageBitmap.html [modify] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/Source/modules/shapedetection/DEPS [modify] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp [modify] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/Source/modules/shapedetection/FaceDetector.h [modify] https://crrev.com/a4f0895546f2d20906d5b276a9aafae9af50dd30/third_party/WebKit/Source/modules/shapedetection/FaceDetector.idl
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/18e8e2880dea2fa45b5edf85a418c12f53547f01 commit 18e8e2880dea2fa45b5edf85a418c12f53547f01 Author: mcasas <mcasas@chromium.org> Date: Tue Nov 01 16:31:12 2016 FaceDetection: add support for <video> input This CL adds support for <video> as input to detect(). Following canvas approach, what is done is to snap the current video frame and use for the detection process. - Some code is refactored in FaceDetector.cpp since, from a c++ perspective, an ImageBitmap and an HTMLVideoElement behave similarly. - some LayoutTests code is refactored since, from the JS/DOM perspective, an HMTLImageElement and an HTMLVideoElement behave similarly. BUG=659138 TEST=LayoutTests. Review-Url: https://codereview.chromium.org/2455973007 Cr-Commit-Position: refs/heads/master@{#429016} [modify] https://crrev.com/18e8e2880dea2fa45b5edf85a418c12f53547f01/third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-empty-input.html [modify] https://crrev.com/18e8e2880dea2fa45b5edf85a418c12f53547f01/third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-security-test.html [modify] https://crrev.com/18e8e2880dea2fa45b5edf85a418c12f53547f01/third_party/WebKit/LayoutTests/http/tests/shapedetection/shapedetection-cross-origin.html [modify] https://crrev.com/18e8e2880dea2fa45b5edf85a418c12f53547f01/third_party/WebKit/LayoutTests/shapedetection/detectface-HTMLImageElement.html [add] https://crrev.com/18e8e2880dea2fa45b5edf85a418c12f53547f01/third_party/WebKit/LayoutTests/shapedetection/detectface-HTMLVideoElement.html [modify] https://crrev.com/18e8e2880dea2fa45b5edf85a418c12f53547f01/third_party/WebKit/LayoutTests/shapedetection/detectface-ImageBitmap.html [modify] https://crrev.com/18e8e2880dea2fa45b5edf85a418c12f53547f01/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp [modify] https://crrev.com/18e8e2880dea2fa45b5edf85a418c12f53547f01/third_party/WebKit/Source/modules/shapedetection/FaceDetector.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7d0018f762087ab6624de7dd09cf15207dda57c6 commit 7d0018f762087ab6624de7dd09cf15207dda57c6 Author: mcasas <mcasas@chromium.org> Date: Thu Dec 08 02:12:42 2016 ShapeDetection: add support for all CanvasImageSource input types Currently ShapeDetector::detectFacesOn{ImageBitmap,Videoelement}() extract the pixels out of the corresponding object; I haven't noticed that CanvasImageSource::getSourceImageForCanvas() is a virtual method, implemented for each CanvasImageSource, doing exactly what I needed, which is extracting an WTF::Image. getSourceImageForCanvas() implementations have the same checks being performed on ToT now, so swapping one for the other is not reducing the early-bail outs. So, this CL factors out the code to use getSourceImageForCanvas(), making the Shape Detection detect() work for all these different input types, and adds LayoutTests for them. BUG= 670977 , 659138 Review-Url: https://codereview.chromium.org/2553343003 Cr-Commit-Position: refs/heads/master@{#437144} [add] https://crrev.com/7d0018f762087ab6624de7dd09cf15207dda57c6/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html [modify] https://crrev.com/7d0018f762087ab6624de7dd09cf15207dda57c6/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html [modify] https://crrev.com/7d0018f762087ab6624de7dd09cf15207dda57c6/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLVideoElement.html [modify] https://crrev.com/7d0018f762087ab6624de7dd09cf15207dda57c6/third_party/WebKit/LayoutTests/shapedetection/detection-ImageBitmap.html [modify] https://crrev.com/7d0018f762087ab6624de7dd09cf15207dda57c6/third_party/WebKit/LayoutTests/shapedetection/detection-options.html [modify] https://crrev.com/7d0018f762087ab6624de7dd09cf15207dda57c6/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp [modify] https://crrev.com/7d0018f762087ab6624de7dd09cf15207dda57c6/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/489ea56faf3d58a0c940cec510a1dc514747d64c commit 489ea56faf3d58a0c940cec510a1dc514747d64c Author: Miguel Casas-Sanchez <mcasas@chromium.org> Date: Tue May 23 03:16:25 2017 Shape Detection: use constructors for UMA counters instead of detect() methods Remove the per-detect() UMA counters and use instead constructors, because in a normal usage pattern the detect() method can be called many times on the same object, and we don't want to skew the UMA. Bug: 659138 Change-Id: Ib4aef88c35dd4853ececbf71cc12a96eaca020f3 Reviewed-on: https://chromium-review.googlesource.com/511344 Commit-Queue: Miguel Casas <mcasas@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#473798} [modify] https://crrev.com/489ea56faf3d58a0c940cec510a1dc514747d64c/third_party/WebKit/Source/core/frame/UseCounter.h [modify] https://crrev.com/489ea56faf3d58a0c940cec510a1dc514747d64c/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.idl [modify] https://crrev.com/489ea56faf3d58a0c940cec510a1dc514747d64c/third_party/WebKit/Source/modules/shapedetection/FaceDetector.idl [modify] https://crrev.com/489ea56faf3d58a0c940cec510a1dc514747d64c/third_party/WebKit/Source/modules/shapedetection/TextDetector.idl [modify] https://crrev.com/489ea56faf3d58a0c940cec510a1dc514747d64c/tools/metrics/histograms/enums.xml
Comment 1 by mcasas@chromium.org
, Oct 25 2016