Hi,
I am trying to extract histograms from a grayscale face image, but I am getting a std::length_error. I am using opencv 3.1.0
This is my code:
int GetHistograms(cv::Mat &features)
{
cv::Mat img;
img = cv::imread("face_grayscale.bmp",CV_LOAD_IMAGE_UNCHANGED);
std::vector<cv::Mat> images;
std::vector<int> labels;
images.push_back(img); labels.push_back(0);
cv::Ptr<cv::face::LBPHFaceRecognizer> model2 = cv::face::createLBPHFaceRecognizer();
model2->train(images, labels);
std::vector<cv::Mat> histogramsS = model2->getHistograms();
features = histogramsS[0];
return histogramsS[0].cols;
}
The code fails on train(images, labels). Going into details, I could see that the exception is through in lbph_faces.cpp in _in_src.getMatVector(src)
I have checked the loaded image is really loaded, has format CV_8U (grayscale), size 100x100 and no stride (isContinuos = true).
Any suggestions?
Thanks.