如何使用Android人脸检测来检测左眼和右眼的坐标 [英] How to detect coordinates of left and right eye using android face detection

查看:78
本文介绍了如何使用Android人脸检测来检测左眼和右眼的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我是android新手.我想检测图像中的毛发以及左眼和右眼的坐标.在此链接中,它显示了什么方法来检测眼睛,但我无法实现这些方法.另外,我想检测图像中的毛发,怎么办.

Hello I am new to android. I want to detect the coordinates of left and right eye along with hairs in an image. In this link it shows that what are the methods to detect eyes that but I am not able to implement these methods. Also I want to detect the hairs in the image so how can I do that.

推荐答案

使用移动视觉API,可以将左眼和右眼检测为面部标志.请参见此处的检测地标教程:

With the mobile vision API, left and right eyes can be detected as facial landmarks. See the tutorial for detecting landmarks here:

https://developers.google.com/vision/detect-faces-tutorial

和API在此处枚举地标类型:

and the API enumerating landmark types here:

https://developers.google.com/android/reference/com/google/android/gms/vision/face/Landmark

仅需对教程中的代码进行少许修改即可:

A slight modification to the code from the tutorial is all that is required to find the eyes specifically:

for (int i = 0; i < faces.size(); ++i) {
  Face face = faces.valueAt(i);
  for (Landmark landmark : face.getLandmarks()) {
    switch (landmark.getType()) {
      case Landmark.LEFT_EYE:
        // use landmark.getPosition() as the left eye position

这篇关于如何使用Android人脸检测来检测左眼和右眼的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆