5
votes

I'm trying to run this sample with OpenCV, but running it:

./facerec_video haarcascade_frontalface_alt.xml csv_align -1  

gives me this error:

OpenCV Error: Bad argument (At least two classes are needed to perform a LDA. Reason: Only one class was given!) in lda, file /build/buildd/opencv-2.4.8+dfsg1/modules/contrib/src/lda.cpp, line 1010 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.4.8+dfsg1/modules/contrib/src/lda.cpp:1010: error: (-5) At least two classes are needed to perform a LDA. Reason: Only one class was given! in function lda

How do I fix it?

Ps.: The xml is the standard OpenCV, and the csv is a sample with 2 images

1
Can you tell us what line it is failing on?Fantastic Mr Fox
well, you need more than 2 classes, that is, images from at least 2 persons. easy to understand, that you want to start small, but usually, you'd need like 10-30 images per person for a decent resultberak

1 Answers

0
votes

I had the same issue and I solved changing my csv.ext file to this style:

C:\Users\fsb\Desktop\image1_20_20_70_70.jpg;0 C:\Users\fsb\Desktop\face_20_20_70_70.jpg;1

Check if your file is according this and try again.