3

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?

Thanks in advance.

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

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);
    }
  • If OpenCV supports java, then you have to port those algorithms to java. Just in case take a look at this question http://stackoverflow.com/questions/1182849/face-detection-in-java – fGo May 29 '13 at 15:26
  • @fGo do you have a working example codes in other programming laguages to port them to Java, i need a tutorial how to do that step by step, and the most importent thing for me now is to have the corner points that i requested in my question, thx –  May 29 '13 at 16:37
  • and about the link that you gave me, i'm actually detecting eyes, mouth and nose using OpenCv with HaarCascade Xml file but i need to get the corners point that i requested in my question, i'll share with you the code i'm using –  May 29 '13 at 16:39

1 Answers1

2

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).

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

  1. http://thebreakfastpost.com/2012/01/23/wrapping-a-c-library-with-jni-part-1/
uricamic
  • 31
  • 4
  • thx for your answer but the link you gave me is not working could you please give me annother –  Jun 06 '13 at 01:57