I am stuck in recognizing face please help me out,below is my code
FaceRecognizer faceRecognizer = com.googlecode.javacv.cpp.opencv_contrib.createFisherFaceRecognizer();
My Train method
public void train(){
IplImage img;
IplImage grayImg;
if(nameList!=null && nameList.size()>0){
for (int i = 0; i < nameList.size(); i++) {
String p = mPath+"person0/"+i+".png";
img = cvLoadImage(p);
labels[i] = i;
grayImg = IplImage.create(img.width(), img.height(), IPL_DEPTH_8U, 1);
cvCvtColor(img, grayImg, CV_BGR2GRAY);
images.put(i, grayImg);
}
}
faceRecognizer.train(images,labels);
}
My Predict Method
public void predict(){
String testPath = mPath+"test/person1.png";
Mat img = imread(testPath);
IplImage ipl = MatToIplImage(img,img.width(), img.width());
int predicted = faceRecognizer.predict(ipl);
Log.v(TAG," predicted : "+predicted);
}
for checking purpose I am using sample image without using device camera,my problem is the predict method gives same result for all sample,please guide me where am i doing mistake