问题
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:
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.
来源:https://stackoverflow.com/questions/25395798/how-to-fix-at-least-two-classes-are-needed-to-perform-a-lda