Need Haar Casscade xml for open mouth
<p>I need to detect an open mouth using Opencv Haar cascade. </p>

<p>I find Haar Casscade for mouth, but it detects mouth in general. I need to distinguish between a close mouth and an open mouth.  </p>

<p>I have a few steps to build my own haar cascade classifier quickly:</p>

<ol>
<li>I always think about sources for my training samples </li>
</ol>

<p>Try to extract positive samples showing different open mouths from free sources like <a href="https://www.flickr.com/search/?text=open%20mouth%20smile" rel="nofollow">flickr</a> or <a href="http://www.face-rec.org/databases/" rel="nofollow">face databases</a>. Extract ~30-50 positive samples. Edit them using gimp to get only the open mouths not the hole faces. Then extract non mouths and closed mouthes (~100 samples).
This is enough to build a weak classifier (more later)</p>

<ol start="2">
<li>Clone this <a href="https://github.com/mrnugget/opencv-haar-classifier-training" rel="nofollow">Github Repo</a> and follow the instructions of the README.md.<br>
Adjust the params -h -w in step 5 &amp; 7 (the size of your sample images) and decrease numStages, numPos, numNeg (used per stage so should be really small)</li>
</ol>

<p>Now you've build your own weak classifier for open mouths but it will detect too much or sometimes closed mouths as well, so  you need more training samples. But this time you can use your weak classifier to create them. </p>

<ol start="3">
<li>I wrote a really simple sample extractor in python. Clone <a href="https://github.com/fabianbormann/Classifier-Sample-Extractor" rel="nofollow">this Github repo</a> and replace the <code>cascade.xml</code> with yours. Add a large set of photos or faces (maybe <a href="http://cswww.essex.ac.uk/mv/allfaces/index.html" rel="nofollow">faces94 by Dr Libor Spacek</a>) to the <code>data</code> folder. And start the extraction using <code>python sample_extractor.py</code>. It will read the files in the data folder randomly and show you white bounding boxes where the classifier found a "open mouth". If you <em>left click</em> the boxes they will become green and the rect will be cropped and added to the <code>positives</code> folder. A <em>right click</em> will add the box to the <code>negative</code> folder. A click with the center <code>mouse button</code> will load the next random data image. Now you can create you training samples really fast. I trained a classifier for various cell types or mitosis detection and it turns out (my personal experience), that ~1000 positive and ~2000 samples would be a good choice. </li>
</ol>

python opencv detection haar-classifier