如何解决“至少需要两个类才能执行LDA"? [英] How to fix "At least two classes are needed to perform a LDA"?
问题描述
我正在尝试运行此带有OpenCV的示例,但可以运行它:
I'm trying to run this sample with OpenCV, but running it:
./facerec_video haarcascade_frontalface_alt.xml csv_align -1
给我这个错误:
OpenCV错误:错误的参数(执行LDA至少需要两个类.原因:只提供了一个类!)在lda中,文件/build/buildd/opencv-2.4.8+dfsg1/modules/contrib/src/lda.cpp,第1010行 抛出'cv :: Exception'实例后调用终止 what():/build/buildd/opencv-2.4.8 + dfsg1/modules/contrib/src/lda.cpp:1010:错误:(-5)执行LDA至少需要两个类.原因:只上了一堂课!在功能lda
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
我该如何解决?
Ps .: xml是标准的 OpenCV ,而csv是具有2个图像的示例
Ps.: The xml is the standard OpenCV, and the csv is a sample with 2 images
推荐答案
我遇到了同样的问题,并且解决了将csv.ext文件更改为以下样式的问题:
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
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.
这篇关于如何解决“至少需要两个类才能执行LDA"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!