title: Detecting mouth with openCV
body: <p>I am trying to detect the mouth in an image with openCV, so I am using the following code:</p>
  
  <pre><code>#include "face_detection.h"
  
  using namespace cv;
  
  // Function detectAndDisplay
  void detectAndDisplay(const std::string&amp; file_name, cv::CascadeClassifier&amp; face_cascade, cv::CascadeClassifier&amp; mouth_cascade)
  {
      Mat frame = imread(file_name);
      std::vector&lt;Rect&gt; faces;
      Mat frame_gray;
      Mat crop;
      Mat res;
      Mat gray;
  
      cvtColor(frame, frame_gray, COLOR_BGR2GRAY);
      equalizeHist(frame_gray, frame_gray);
  
      // Detect faces
      face_cascade.detectMultiScale(frame_gray, faces, 1.1, 3, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));
  
      for(unsigned int i=0;i&lt;faces.size();i++)
      {
          rectangle(frame,faces[i],Scalar(255,0,0),1,8,0);
          Mat face  = frame(faces[i]);
          cvtColor(face,face,CV_BGR2GRAY);
          std::vector &lt;Rect&gt; mouthi;
          mouth_cascade.detectMultiScale(face, mouthi);
          for(unsigned int k=0;k&lt;mouthi.size();k++)
          {
          Point pt1(mouthi[k].x+faces[i].x , mouthi[k].y+faces[i].y);
          Point pt2(pt1.x+mouthi[k].width, pt1.y+mouthi[k].height);
          rectangle(frame, pt1,pt2,Scalar(0,255,0),1,8,0);
          }
  
      }
  
      imshow("Frame", frame);
      waitKey(33);
  }
  </code></pre>
  
  <p>The classifiers are <code>haarcascade_frontalface_alt.xml</code> and <code>haarcascade_mcs_mouth.xml</code>.</p>
  
  <p>The face is detected correctly but the mouth is not: I also obtain the eyes and some other parts, like the forehead.
  Is there a way to detect only the mouth?</p>