After posting the same question in OpenCV Forum, I learned that the problem is in my sample code. Some portions are not applicable for LBPH Algorithm. The lines are below:
Mat reconstructedFace;
reconstructedFace = reconstructFace(model, preprocessedFace);
if (m_debug)
if (reconstructedFace.data)
imshow("reconstructedFace", reconstructedFace);
// Verify whether the reconstructed face looks like the preprocessed face, otherwise it is probably an unknown person.
double similarity = getSimilarity(preprocessedFace, reconstructedFace);
The above lines of code are applicable for Eigenfaces and Fisherfaces which I don't know! After commenting those lines of code, I simply call
identity = model->predict(preprocessedFace);
which gives the prediction result and hence.