我正在使用面部識別示例:http://docs.opencv.org/trunk/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html。 我在Ubuntu上使用eclipse,如果多數民衆贊成相關。之前我使用的是2.3.1,但是它出現了一個錯誤‘FaceRecognizer’ was not declared in this scope
,所以在通過這裏的回覆之後https://stackoverflow.com/a/11399099/824239我更新到了另一條路徑上的opencv版本2.4.5,但之前版本的opencv仍在機器上。現在在將我的include路徑和庫引導到eclipse項目中的新位置後,我仍然得到相同的錯誤。Facerecognizer with opencv 2.4.5
make all
Building file: ../src/faceRec_vid.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/research/opencv/include/opencv2 -I/usr/local/research/opencv/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/faceRec_vid.d" -MT"src/faceRec_vid.d" -o"src/faceRec_vid.o" "../src/faceRec_vid.cpp"
../src/faceRec_vid.cpp: In function ‘int main(int, const char**)’:
../src/faceRec_vid.cpp:87:9: error: ‘FaceRecognizer’ was not declared in this scope
../src/faceRec_vid.cpp:87:23: error: template argument 1 is invalid
../src/faceRec_vid.cpp:87:31: error: invalid type in declaration before ‘=’ token
../src/faceRec_vid.cpp:87:60: error: ‘createFisherFaceRecognizer’ was not declared in this scope
../src/faceRec_vid.cpp:88:10: error: base operand of ‘->’ is not a pointer
../src/faceRec_vid.cpp:118:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../src/faceRec_vid.cpp:136:35: error: base operand of ‘->’ is not a pointer
make: *** [src/faceRec_vid.o] Error 1
我是否缺少任何需要做的事情來指導我的eclipse項目到正確的版本。我怎樣才能擺脫這個錯誤。
我已經做到了。庫搜索路徑指向opencv2.4.5庫。 – 2013-05-22 09:23:11
@UmairR。那爲什麼'g ++'用-l或-L調用opencv庫?您是否嘗試使用'g ++ -I/usr/local/research/opencv/include/opencv2 -I/usr/local/research/opencv/include/opencv -O0 -g3編譯'faceRec_vid.cpp'文件-Wall -c -L $ OPENCVLIBS_DIR -o「src/faceRec_vid.o」「../ src/faceRec_vid.cpp」'。其中$ OPENCVLIBS_DIR是鏈接器可以找到opencv2.4.5庫的目錄。 – PraveenPalanisamy 2013-06-23 15:01:45
你有一個有效的poitn在這裏,但我不知道爲什麼它(日食)不調用-l或-L選項。無論如何,即使上面的命令,你說我得到完全相同的錯誤。 – 2013-06-27 14:57:52