Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp

Issue 2502763005: ShapeDetection: Add FaceDetectorOptions for fastMode and maxDetectedFaces (Closed)
Patch Set: 80 cols Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/shapedetection/FaceDetector.h" 5 #include "modules/shapedetection/FaceDetector.h"
6 6
7 #include "core/dom/DOMException.h" 7 #include "core/dom/DOMException.h"
8 #include "core/frame/LocalDOMWindow.h" 8 #include "core/frame/LocalDOMWindow.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/html/canvas/CanvasImageSource.h" 10 #include "core/html/canvas/CanvasImageSource.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 FaceDetector* FaceDetector::create(ScriptState* scriptState) { 14 FaceDetector* FaceDetector::create(ScriptState* scriptState,
15 return new FaceDetector(*scriptState->domWindow()->frame()); 15 const FaceDetectorOptions& options) {
16 return new FaceDetector(*scriptState->domWindow()->frame(), options);
16 } 17 }
17 18
18 FaceDetector::FaceDetector(LocalFrame& frame) : ShapeDetector(frame) {} 19 FaceDetector::FaceDetector(LocalFrame& frame,
20 const FaceDetectorOptions& options)
21 : ShapeDetector(frame) {
22 m_options = mojom::blink::FaceDetectorOptions::New();
23 m_options->max_detected_faces = options.maxDetectedFaces();
24 m_options->fast_mode = options.fastMode();
Reilly Grant (use Gerrit) 2016/11/22 20:33:33 Pass options to the ShapeDetector constructor and
25 }
19 26
20 ScriptPromise FaceDetector::detect(ScriptState* scriptState, 27 ScriptPromise FaceDetector::detect(ScriptState* scriptState,
21 const CanvasImageSourceUnion& imageSource) { 28 const CanvasImageSourceUnion& imageSource) {
22 return detectShapes(scriptState, ShapeDetector::DetectorType::Face, 29 return detectShapes(scriptState, ShapeDetector::DetectorType::Face,
23 imageSource); 30 imageSource);
24 } 31 }
25 32
26 DEFINE_TRACE(FaceDetector) { 33 DEFINE_TRACE(FaceDetector) {
27 ShapeDetector::trace(visitor); 34 ShapeDetector::trace(visitor);
28 } 35 }
29 36
30 } // namespace blink 37 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698