mayooran mayooran - 1 month ago 14
Linux Question

Why am I getting an opencv error with size of images when they are as expected?

I was trying to run the opencv gender classification example from this site,
http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_gender_classification.html
When I try to run the facerec_fisherfaces.cpp it gives an error saying,

OpenCV Error: Unsupported format or combination of formats (In the Fisherfaces method all input samples (training images) must be of equal size! Expected 40000 pixels, but was 0 pixels.) in train, file /home/kavin/opencv/opencv-2.4.10/modules/contrib/src/facerec.cpp, line 564
terminate called after throwing an instance of 'cv::Exception'
what(): /home/kavin/opencv/opencv- 2.4.10/modules/contrib/src/facerec.cpp:564: error: (-210) In the Fisherfaces method all input samples (training images) must be of equal size! Expected 40000 pixels, but was 0 pixels. in function train

Aborted (core dumped)


The following is a csv file entry I have used fir this program:

/home/kavin/Desktop/actors_cropped/female/an1_200_200.jpg;0

I have 50 such entries and images exist in those locations of size 200*200. I have used the same code facerec_fisherfaces.cpp as in the tutorial link i have posted. Please help.

Answer

This was because there was an empty row in the csv file and also the encoding had to be UTF-8