获取我们在 Firebase 峰会上发布的所有信息,了解 Firebase 可如何帮助您加快应用开发速度并满怀信心地运行应用。
了解详情
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
人脸检测
plat_ios
plat_android

使用 ML Kit 的人脸检测 API,您可以检测图像中的人脸、识别关键面部特征并获取检测到的人脸的轮廓。
通过面部检测,您可以获得执行任务所需的信息,例如修饰自拍和肖像,或从用户的照片生成头像。由于 ML Kit 可以实时执行面部检测,因此您可以在视频聊天或响应玩家表情的游戏等应用程序中使用它。
iOS安卓
如果您是 Flutter 开发人员,您可能会对FlutterFire感兴趣,它包含一个用于 Firebase 的 ML Vision API 的插件。
关键能力
识别和定位面部特征 | 获取检测到的每张脸的眼睛、耳朵、脸颊、鼻子和嘴巴的坐标。 |
获取面部特征的轮廓 | 获取检测到的人脸及其眼睛、眉毛、嘴唇和鼻子的轮廓。 |
识别面部表情 | 确定一个人是在微笑还是闭着眼睛。 |
跨视频帧跟踪人脸 | 获取检测到的每个人脸的标识符。此标识符在调用中是一致的,因此您可以例如对视频流中的特定人执行图像处理。 |
实时处理视频帧 | 人脸检测在设备上执行,速度足够快,可用于实时应用,例如视频处理。 |
示例结果
示例 1

对于检测到的每个人脸:
第 1 个,共 3 个 |
---|
边界多边形 | (884.880004882812, 149.546676635742), (1030.77197265625, 149.546676635742), (1030.77197265625, 329.660278320312), (884.20100460228) |
旋转角度 | Y:-14.054030418395996,Z:-55.007488250732422 |
跟踪号码 | 2 |
面部标志 | 左眼 | (945.869323730469, 211.867126464844) | 右眼 | (971.579467773438, 247.257247924805) | 嘴巴底部 | (907.756591796875, 259.714477539062) |
... ETC。 |
特征概率 | 微笑 | 0.88979166746139526 | 左眼睁开 | 0.98635888937860727 | 右眼睁开 | 0.99258323386311531 |
|
示例2(人脸轮廓检测)
启用面部轮廓检测后,您还将获得检测到的每个面部特征的点列表。这些点代表特征的形状。下图说明了这些点如何映射到人脸(单击图像放大):

面部特征轮廓 |
---|
鼻梁 | (505.149811, 221.201797), (506.987122, 313.285919) |
左眼 | (404.642029, 232.854431), (408.527283, 231.366623), (413.565796, 229.427856), (421.378296, 226.967682), (432.598755, 225.434143), (442.953064, 226.089508), (453.899811, 228.594818), (461.516418, 232.650467), (465.069580 , 235.600845), (462.170410, 236.316147), (456.233643, 236.891602), (446.363922, 237.966888), (435.698914, 238.149323), (424.320740, 237.235168), (416.037720, 236.012115), (409.983459, 234.870300) |
上唇顶部 | (421.662048, 354.520813), (428.103882, 349.694061), (440.847595, 348.048737), (456.549988, 346.295532), (480.526489, 346.089294), (503.375702, 349.470459), (525.624634, 347.352783), (547.371155, 349.091980), (560.082031 , 351.693268), (570.226685, 354.210175), (575.305420, 359.257751) |
(ETC。) | |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-01-18 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]