chromium/services/shape_detection/public/mojom/facedetection.mojom

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://wicg.github.io/shape-detection-api/#api

module shape_detection.mojom;

import "skia/public/mojom/bitmap.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";

// https://wicg.github.io/shape-detection-api/#enumdef-landmarktype
enum LandmarkType { MOUTH, EYE, NOSE };

// https://wicg.github.io/shape-detection-api/#dictdef-landmark
struct Landmark {
  array<gfx.mojom.PointF> locations;
  LandmarkType type;
};

// Since "//ui/gfx/geometry/mojom" is not exposed to blink, we need to declare
// a wrapper struct, so that gfx.mojom.RectF will not be directly referenced
// inside Blink, and browser can still use gfx types.
struct FaceDetectionResult {
  gfx.mojom.RectF bounding_box;
  array<Landmark> landmarks;
};

struct FaceDetectorOptions {
  uint32 max_detected_faces;
  bool fast_mode;
};

interface FaceDetection {
  Detect(skia.mojom.BitmapN32 bitmap_data)
    => (array<FaceDetectionResult> results);
};