我正在使用某人使用OpenCV的原始代码(http://www.shervinemami.info/faceRecognition.html)。我遇到了一些 OpenCV 对象的标识符,有些没有问题。
例如:
CvRect ROI = cvRect(x, y, w, h);
cvSetImageROI(bigImg, ROI);
cvCopyImage(byteImg, bigImg); //For example here only this function is making problems
cvResetImageROI(bigImg);
cvReleaseImage(&byteImg);
这是因为不同的OpenCV版本吗?
生成输出:
1>------ Build started: Project: OnlineFaceRec, Configuration: Debug Win32 ------
1>Build started 04.04.2014 21:47:28.
1>InitializeBuildStatus:
1> Creating "DebugOnlineFaceRec.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> OnlineFaceRec.cpp
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(220): error C3861: 'cvCopyImage': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(255): error C3861: 'cvEigenDecomposite': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(308): error C2065: 'fileStorafge' : undeclared identifier
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(402): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(440): error C2065: 'CV_EIGOBJ_NO_CALLBACK' : undeclared identifier
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(436): error C3861: 'cvCalcEigenObjects': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(554): error C3861: 'cvEigenDecomposite': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(605): error C3861: 'Sleep': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(631): error C3861: 'cvCvtColor': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(660): error C3861: 'cvResize': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(665): error C3861: 'cvResize': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(763): error C3861: 'cvCvtColor': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(843): error C2065: 'FALSE' : undeclared identifier
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(849): error C2065: 'FALSE' : undeclared identifier
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(909): error C2065: 'VK_ESCAPE' : undeclared identifier
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(936): error C2065: 'TRUE' : undeclared identifier
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(943): error C2065: 'FALSE' : undeclared identifier
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(962): error C2065: 'FALSE' : undeclared identifier
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(996): error C3861: 'cvEqualizeHist': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(1006): error C3861: 'cvEigenDecomposite': identifier not found
1>c:usersfarazdesktoponlinefacereconlinefacerec.cpp(1062): error C2065: 'VK_ESCAPE' : undeclared identifier
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.52
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
嗯
,Shervin很棒,但代码有点旧。
与此同时,OpenCV API转移到C ++,它现在具有开箱即用的适当面部识别功能,并且该代码中似乎隐藏了一些"Win32 Special"函数。
也许你可能想看看这里:https://github.com/MasteringOpenCV/code/tree/master/Chapter8_FaceRecognition
对于稍微新鲜的版本