0

I want to train my own haar cascade and generate my own xml file. But I am a worried that it takes my whole time. I need to train the classifier for 5 profile images in order that it detects their nose and mouth in profile images. I want to know how much time does it take to do so since I have very few days to submit my project. Also,are there any other alternatives in opencv to detect the coordinates of nose tip and mouth corner in profile images? I have posted a few times about this but people answer with research papers.

Steph
  • 609
  • 3
  • 13
  • 32
  • 3
    try to train a lbp cascade first. for a few hundred images, it will train whithin minutes( not days, like the haar version ) – berak Mar 04 '14 at 10:57
  • lbp cascade?I do not need to detect faces,only the nose and mouth in profile face images. How should I start?Is there a guide for dummies? :p – Steph Mar 04 '14 at 11:01

1 Answers1

1

If you have no ample time, I suggest you an alternative (done by opencv) to use this library (flandmark). It's very easy to integrate (no more than 3 minutes).

Download the files (cpp,h), put them in your project's directory . It is very important to not forget to call in your code this line:

FLANDMARK_Model * model = flandmark_init("flandmark_model.dat");

Check the example in the same page.

Actually flandmark_model.dat is a detection model, already trained to for facial landmarks detection. This open source library uses Opencv.

Let me know if you have a problem of integration

EDIT:

IF you need only eyes, nose, and mouth points, you just select your choices from the array containing facial landmarks (float* landmarks), such:

extern_Right eye.x = landmarks[12];
extern_Right eye.y = landmarks[13];
nose.x = landmarks[14]
nose.y = landmarks[15]
leftmouth.x = landmarks[6]
leftmouth.x = landmarks[7]
rightmouth.x = landmarks[8]
rightmouth.x = landmarks[9] 
Y.AL
  • 1,808
  • 13
  • 27
  • I know about flandmark,I have tried it.There's an example for static images.I was trying to understand the code so I could change it to detect only some face features,but I could not – Steph Mar 04 '14 at 13:57
  • you don't need to change the original code, if you need only some of them you can take what you want from landmarks array : as you have: float * landmarks = (float*)malloc(2*model->data.options.M*sizeof(float)); – Y.AL Mar 04 '14 at 14:14
  • the default flandmark model works nicely with frontal faces, but above problem is with profiles. you'd have to train another flandmark model to make it work properly – berak Mar 04 '14 at 14:38
  • I did that the last time,ie,removing the parts that were irrelevant but it was still displaying all the points on the face.Here is the code that I have http://pastebin.com/wFfACrzR. Will the flandmark detector detect profile images properly? – Steph Mar 04 '14 at 14:40
  • 1
    As I told you, your code dispalys all points, because you plot all of them, check the loop (line 99 to 103), you don't need to display all of them, just do for the indexes that I put in my edited answer. For the profile I did not test them by flandmark, but it works well for the multiple poses of face – Y.AL Mar 04 '14 at 14:51
  • I do not know why it is not working despite changing lines 190-196 and lines 224-230 by replacing it with the above. I did not change the loop though,I am not able to understand it :S – Steph Mar 04 '14 at 19:11
  • try my suggestion to keep only what you get from float * landmarks array – Y.AL Mar 05 '14 at 08:44