List of usage examples for org.opencv.objdetect CascadeClassifier empty
public boolean empty()
From source file:com.raulh82vlc.face_detection_sample.opencv.presentation.FDOpenCVPresenter.java
License:Apache License
private synchronized CascadeClassifier initializeJavaDetector(File cascadeFile) { CascadeClassifier detector = new CascadeClassifier(cascadeFile.getAbsolutePath()); detector.load(cascadeFile.getAbsolutePath()); if (detector.empty()) { Log.e(TAG, "Failed to load cascade classifier"); detector = null;/*from w w w . j a va2 s. co m*/ } else { Log.i(TAG, "Loaded cascade classifier from " + cascadeFile.getAbsolutePath()); } return detector; }
From source file:interactivespaces.activity.image.vision.opencv.outline.ImageOpenCvVisionFaceDetectActivity.java
License:Apache License
/** * Get the classifier to use./*from w w w .j a va 2 s . c o m*/ * * @param classifierName * the name of the classifier * * @return the classifier */ private CascadeClassifier getClassifier(String classifierName) { File haarCascadesDirectoryPath = new File(getSpaceEnvironment().getFilesystem().getInstallDirectory(), CASCADE_DATA_ROOT); String classifierPath = new File(haarCascadesDirectoryPath, classifierName).getAbsolutePath(); CascadeClassifier classifier = new CascadeClassifier(classifierPath); if (classifier.empty()) { throw new SimpleInteractiveSpacesException( String.format("Cannot find face classification file %s", classifierPath)); } return classifier; }