here is the code
int train_ellen(vector<mat>& images) {
Mat image=imread("ellen1.jpg", CV_LOAD_IMAGE_GRAYSCALE);
if(image.empty) {images.push_back(image); labels.push_back(0);} else return 0; image=imread("ellen2.jpg", CV_LOAD_IMAGE_GRAYSCALE); if(image.data) {images.push_back(image); labels.push_back(1);} else return 0; image=imread("ellen3.jpg", CV_LOAD_IMAGE_GRAYSCALE); if(image.data) {images.push_back(image); labels.push_back(2);} else return 0; for(int i=0; i < images.size(); i++) {
resize(images[i],images[0],images[0].size(),1.0,1.0, INTER_NEAREST );
}
model->train(images, labels);
return 1;
} all three images are in the project folder.