opencv包含库文件通用任何版本

只要在头文件中加入以下代码即可:

#define CV_VERSION_ID       CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION)

#ifdef _DEBUG
#define cvLIB(name) "opencv_" name CV_VERSION_ID "d"
#else
#define cvLIB(name) "opencv_" name CV_VERSION_ID
#endif


#pragma comment( lib, cvLIB("core") )
#pragma comment( lib, cvLIB("imgproc") )
#pragma comment( lib, cvLIB("highgui") )
#pragma comment( lib, cvLIB("calib3d") )
#pragma comment( lib, cvLIB("objdetect") )
#pragma comment( lib, cvLIB("ml") )
#pragma comment( lib, cvLIB("legacy") )
#pragma comment( lib, cvLIB("features2d") )
#pragma comment( lib, cvLIB("videostab") )
#pragma comment( lib, cvLIB("nonfree") )

using namespace cv;

你可能感兴趣的:(opencv)