簡體   English   中英

使用OpenCV進行面部特征檢測,眼睛和嘴角點

[英]Facial feature detection with OpenCV with eyes and mouth corners points

我正在進行面部特征檢測項目,我確實使用OpenCv withHaarcascade xml文件檢測眼睛,鼻子和嘴巴。 但是,我希望有眼睛和嘴角點和鼻子中心。 目標是用它來預測情緒。 我發現這個鏈接顯示它是如何工作的,我需要使用JAVA來獲得這個結果。 任何人都可以幫助我嗎?

提前致謝。

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

在這一部分,我們收到了臉部圖像,我們在臉上畫出了反射:

 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無關,只有該庫中包含的示例正在使用它(用於面部檢測和顯示結果)。

我找到了一些關於如何使用JAVA的C ++庫的漂亮教程:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM