how to trigger two classifiers in Android javaCV example
In the basic Object detection javaCV example , i tried to use two classifiers, one for face and other one for eyes. But surely I am doing something wrong that always the single one is coming. I am doing this just for the sake of learning , I even checked other example of OpenCV , but couldn't find whats wrong i am doing.
protected void processImage(byte[] data, int width, int height) {
// First, downsample our image and convert it into a grayscale IplImage
int f = SUBSAMPLING_FACTOR;
if (grayImage == null || grayImage.width() != width/f || grayImage.height() != height/f) {
grayImage = IplImage.create(width/f, height/f, IPL_DEPTH_8U, 1);
}
int imageWidth = grayImage.width();
int imageHeight = grayImage.height();
int dataStride = f*width;
int imageStride = grayImage.widthStep();
ByteBuffer imageBuffer = grayImage.getByteBuffer();
for (int y = 0; y < imageHeight; y++) {
int dataLine = y*dataStride;
int imageLine = y*imageStride;
for (int x = 0; x < imageWidth; x++) {
imageBuffer.put(imageLine + x, data[dataLine + f*x]);
}
}
cvClearMemStorage(storage);
faces = cvHaarDetectObjects(grayImage, classifier, storage, 1.1, 3, CV_HAAR_DO_ROUGH_SEARCH | CV_HAAR_FIND_BIGGEST_OBJECT);
faces = cvHaarDetectObjects(grayImage, classifier_eyes, storage, 1.1, 3, CV_HAAR_DO_CANNY_PRUNING);
postInvalidate();
}
Here I've tried to add both the classifiers to the same face Object. Initially it was just one. Here always the last one takes preference, can anybody suggest the actual way to add two classifiers in the following scenario