July 2015
Intermediate to advanced
174 pages
3h 45m
English
OpenCV already comes with several previously-trained cascades that are ready to be used. Among them, we can find front and profile face detectors as well as eye, body, mouth, nose, lower-body, and upper-body detectors. In this section, we will cover how to use them. The complete source can be found in the project cascade in this chapter.
The following code shows how to load a trained cascade:
private void loadCascade() {
String cascadePath = "src/main/resources/cascades/lbpcascade_frontalface.xml";
faceDetector = new CascadeClassifier(cascadePath);
}Most of the action happens in the class CascadeClassifier, from the objdetect package. This class wraps cascade loading and object detection. The constructor with strings already loads the ...
Read now
Unlock full access