opencv/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.markdown

67 lines
2.8 KiB
Markdown
Raw Normal View History

2014-11-27 20:39:05 +08:00
Cascade Classifier {#tutorial_cascade_classifier}
==================
Goal
----
In this tutorial you will learn how to:
- Use the @ref cv::CascadeClassifier class to detect objects in a video stream. Particularly, we
will use the functions:
2014-11-28 00:54:13 +08:00
- @ref cv::CascadeClassifier::load to load a .xml classifier file. It can be either a Haar or a LBP classifer
- @ref cv::CascadeClassifier::detectMultiScale to perform the detection.
2014-11-27 20:39:05 +08:00
Theory
------
Code
----
@add_toggle_cpp
2014-11-27 20:39:05 +08:00
This tutorial code's is shown lines below. You can also download it from
[here](https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/objectDetection/objectDetection.cpp)
2016-07-18 21:32:05 +08:00
@include samples/cpp/tutorial_code/objectDetection/objectDetection.cpp
@end_toggle
@add_toggle_java
This tutorial code's is shown lines below. You can also download it from
[here](https://github.com/opencv/opencv/tree/3.4/samples/java/tutorial_code/objectDetection/cascade_classifier/ObjectDetectionDemo.java)
@include samples/java/tutorial_code/objectDetection/cascade_classifier/ObjectDetectionDemo.java
@end_toggle
@add_toggle_python
This tutorial code's is shown lines below. You can also download it from
[here](https://github.com/opencv/opencv/tree/3.4/samples/python/tutorial_code/objectDetection/cascade_classifier/objectDetection.py)
@include samples/python/tutorial_code/objectDetection/cascade_classifier/objectDetection.py
@end_toggle
2014-11-27 20:39:05 +08:00
Explanation
-----------
Result
------
2014-11-28 21:21:28 +08:00
-# Here is the result of running the code above and using as input the video stream of a build-in
2014-11-27 20:39:05 +08:00
webcam:
2014-11-28 21:21:28 +08:00
![](images/Cascade_Classifier_Tutorial_Result_Haar.jpg)
2014-11-27 20:39:05 +08:00
2017-01-19 17:17:53 +08:00
Be sure the program will find the path of files *haarcascade_frontalface_alt.xml* and
*haarcascade_eye_tree_eyeglasses.xml*. They are located in
2014-11-27 20:39:05 +08:00
*opencv/data/haarcascades*
2014-11-28 21:21:28 +08:00
-# This is the result of using the file *lbpcascade_frontalface.xml* (LBP trained) for the face
2014-11-27 20:39:05 +08:00
detection. For the eyes we keep using the file used in the tutorial.
2014-11-28 21:21:28 +08:00
![](images/Cascade_Classifier_Tutorial_Result_LBP.jpg)
Additional Resources
--------------------
-# Paul Viola and Michael J. Jones. Robust real-time face detection. International Journal of Computer Vision, 57(2):137154, 2004. @cite Viola04
-# Rainer Lienhart and Jochen Maydt. An extended set of haar-like features for rapid object detection. In Image Processing. 2002. Proceedings. 2002 International Conference on, volume 1, pages I900. IEEE, 2002. @cite Lienhart02
-# Video Lecture on [Face Detection and Tracking](https://www.youtube.com/watch?v=WfdYYNamHZ8)
-# An interesting interview regarding Face Detection by [Adam
Harvey](https://web.archive.org/web/20171204220159/http://www.makematics.com/research/viola-jones/)
-# [OpenCV Face Detection: Visualized](https://vimeo.com/12774628) on Vimeo by Adam Harvey