Head (and shoulder) detection using OpenCV

You can as well create your own cascade classifier to detect heads. The upper body is not the head at all, but just heads is not that accurate. You need to crop several number of positive samples and negative ones. Prepare list of these example in text.txt, opencv_createsamples.exe(prepare input vector for training) and use opencv_traincascade.exe command line utility to create opencv classifier for cascade detect multiscale. It is easy but the creating the dataset is time consuming. My head LBP cascade is available here for free download link to my blog for head, car and people cascade . It is compatible with detectMultiscale, but not that accurate.


Look at all the Haar boosted classifiers that are available with OpenCV and the dedicated class CascadeClassifier to use it. Here are a list of what the classifiers have locally:

  • haarcascade_eye.xml
  • haarcascade_lefteye_2splits.xml
  • haarcascade_mcs_righteye.xml
  • haarcascade_eye_tree_eyeglasses.xml
  • haarcascade_lowerbody.xml
  • haarcascade_mcs_upperbody.xml
  • haarcascade_frontalface_alt.xml
  • haarcascade_mcs_eyepair_big.xml
  • haarcascade_profileface.xml
  • haarcascade_frontalface_alt2.xml
  • haarcascade_mcs_eyepair_small.xml
  • haarcascade_righteye_2splits.xml
  • haarcascade_frontalface_alt_tree.xml
  • haarcascade_mcs_lefteye.xml
  • haarcascade_upperbody.xml
  • haarcascade_frontalface_default.xml
  • haarcascade_mcs_mouth.xml
  • haarcascade_fullbody.xml
  • haarcascade_mcs_nose.xml

The two I bolded may be of special interest to you. Try those as a start for your project. As Alessandro Vermeulen commented, head detection classifiers may also be interesting, as what they find is usely connected to shoulders :-)

Tags:

Opencv