How to fix “At least two classes are needed to perform a LDA”?

徘徊边缘 提交于 2019-12-10 05:15:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!