使用带有眼睛和嘴角点的OpenCV进行面部特征检测 [英] Facial feature detection with OpenCV with eyes and mouth corners points

查看:203
本文介绍了使用带有眼睛和嘴角点的OpenCV进行面部特征检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究面部特征检测项目,并且使用带有Haarcascade xml文件的OpenCv来检测眼睛,鼻子和嘴巴.但是,我想拥有眼睛和嘴角点以及鼻子中心.目标是使用它来预测情绪.我发现此链接显示了它是如何工作的,我需要使用JAVA来获得此结果.有人可以帮我吗?

I'm working on a face feature detection project and I do detect the eyes, nose and mouth using OpenCv withHaarcascade xml files. But, I want to have the eyes and mouth corners points and the nose center. The goal is using it to predict emotions. I found this link that shows how it works, and I need to get to this result using JAVA. Could any one help me?

先谢谢了.

http://cmp.felk.cvut.cz/~uricamic/flandmark/

在这一部分中,我们接收人脸图像,然后在人脸上绘制drawRect:

in this part we receve the face image and we drawRect on the face:

 public void drawFaces(BufferedImage image) {
    final List<PotentialFace> faces = FacialRecognition.run(image, db);
    if (faces.isEmpty()) {
      return;
    }
    Graphics2D g2 = image.createGraphics();
    g2.setStroke(new BasicStroke(2));
    currentFaces.clear();
    for (PotentialFace face : faces) {
      final Rectangle r = face.box;
      final Color c1, c2;
      final String msg;
      if (face.name == null) {
        c1 = c2 = new Color(scale(r.x, getWidth(), 255d), scale(r.y, getHeight(), 255d), 0).brighter();
        msg = "Click to tag";
      } else {
        c1 = new Color(face.name.hashCode()).brighter();
        c2 = new Color((int) (c1.getRGB() - 10*face.confidence));
        msg = String.format("%s: %f", face.name, face.confidence);
      }
      g2.setColor(c1);
      g2.drawRect(r.x, r.y, r.width, r.height);
      g2.setColor(c2);
      g2.drawString(msg, r.x + 5, r.y - 5);
      currentFaces.add(r);
    }

推荐答案

,因为 flandmark 是C ++库,它完全可以满足您的要求(找到眼睛,嘴巴和鼻中部/鼻尖的角点),我认为您应该只寻找如何从JAVA中运行该库的机制. flandmark本身是OpenCV独立的,只有该库中包含的示例正在使用它(用于面部检测和显示结果).

since flandmark is the C++ library which does exactly what you want (finds corner points for eyes, mouth and center/tip of nose), I think you should just look for the mechanism of how to run this library from within JAVA. flandmark itself is OpenCV independent, only examples included in this library are using it (for face detection and displaying the results).

我找到了一些有关如何使用JAVA中的C ++库的漂亮教程:

I found some nice-looking tutorials on how to use C++ libraries from JAVA:

  1. http://thebreakfastpost.com /2012/01/23/wrapping-ac-library-with-jni-part-1/

这篇关于使用带有眼睛和嘴角点的OpenCV进行面部特征检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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