hi,
i wanna do the same thing using the sample facedetection of opencv 2.4.2.
my problem is when i tried to load the two cascade classifier files it doesn't work for the second file.this is what i did:
try {
InputStream is = context.getResources().openRawResource(R.raw.haarcascade_profileface);
File cascadeDir = context.getDir("cascade", Context.MODE_PRIVATE);
mCascadeFile = new File(cascadeDir, "haarcascade_profileface.xml");
mCascadeFileeyes = new File(cascadeDir, "haarcascade_eye_tree_eyeglasses.xml");
FileOutputStream os = new FileOutputStream(mCascadeFile);
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = is.read(buffer)) != -1) {
os.write(buffer, 0, bytesRead);
}
is.close();
os.close();
mJavaDetector = new CascadeClassifier(mCascadeFile.getAbsolutePath());
mJavaDetectoreye=new CascadeClassifier(mCascadeFileeyes.getAbsolutePath());
//mJavaDetectoreye.load("haarcascade_eye_tree_eyeglasses.xml");
if (mJavaDetector.empty()) {
Log.e(TAG, "Failed to load cascade classifier");
mJavaDetector = null;
} else
Log.i(TAG, "Loaded cascade classifier from " + mCascadeFile.getAbsolutePath());
if (mJavaDetectoreye.empty()) {
Log.e(TAG, "Failed to load cascade classifiereye");
mJavaDetectoreye = null;
} else
Log.i(TAG, "Loaded cascade classifier from " + mCascadeFileeyes.getAbsolutePath());
when i run the project it crashed and show in the logcat error :Failed to load cascadeclassifiereye
=>it seams to be not loading the eyes classifier file
So can i load the 2 files ? and how can i detect eyes and face ?is there any way to do it? please i really need help to solve this problem as soon as possible. thanks in advance