OpenCV配置

配置环境变量

1、系统变量:添加变量名:Path

变量值:D:\ProgramFiles\OpenCV2.4.8\opencv\build\x86\vc12\bin

 

2、用户变量:添加变量名:PATH(有就不需要添加,但是值需要添加)D:\ProgramFiles\OpenCV2.4.8\opencv\build

D:\ProgramFiles\OpenCV2.4.8\opencv\build\x86\vc12\bin

 

说明:不管系统是32位还是64位,路径目录均选择X86,因为编译都是使用32位编译;

 

3、包含目录:(VC++目录)

D:\ProgramFiles\OpenCV2.4.8\opencv\build\include

D:\ProgramFiles\OpenCV2.4.8\opencv\build\include\opencv2

D:\ProgramFiles\OpenCV2.4.8\opencv\build\include\opencv

 

4、库目录:

D:\ProgramFiles\OpenCV2.4.8\opencv\build\x86\vc12\lib

 

5、连接器->输入->附加依赖项:

opencv_calib3d248d.lib

opencv_contrib248d.lib

opencv_core248d.lib

opencv_features2d248d.lib

opencv_flann248d.lib

opencv_gpu248d.lib

opencv_highgui248d.lib

opencv_imgproc248d.lib

opencv_legacy248d.lib

opencv_ml248d.lib

opencv_nonfree248d.lib

opencv_objdetect248d.lib

opencv_ocl248d.lib

opencv_photo248d.lib

opencv_stitching248d.lib

opencv_superres248d.lib

opencv_ts248d.lib

opencv_video248d.lib

opencv_videostab248d.lib

opencv_calib3d248.lib

opencv_contrib248.lib

opencv_core248.lib

opencv_features2d248.lib

opencv_flann248.lib

opencv_gpu248.lib

opencv_highgui248.lib

opencv_imgproc248.lib

opencv_legacy248.lib

opencv_ml248.lib

opencv_nonfree248.lib

opencv_objdetect248.lib

opencv_ocl248.lib

opencv_photo248.lib

opencv_stitching248.lib

opencv_superres248.lib

opencv_ts248.lib

opencv_video248.lib

opencv_videostab248.lib

 

永久配置:

菜单栏视图->其他窗口->属性管理器(单击)。在弹出的窗口双击Debug|Win32项下一级Microsoft.Cpp.Win32.user项"后面的配置和单次配置一样,在永久配置中,不能一次同时配置Release和Debug,这样会造成混乱,在两种运行模式下使用的库可能只是其中一种的(Release或Debug)。所以,为了避免这个问题,需要每次配置只能是一种(Release或Debug)。例如:当需要在Debug模式下开发各种项目时,只需要一次配置Debug;如果需要在Release下运行发布时,不能再利用原来的配置,需要再次重新按照Release配置方式进行配置

 

测试代码

#include

#include

using namespace cv;

using namespace std;

int main()

{

    Mat srcImage = imread("1.jpg");

    if (NULL == srcImage.data)

    {

        cout << "can't find image!" << endl;

        return -1;

    }

    imshow("【原图】", srcImage);

    waitKey(0);

    return 0;

}

 

 

 

 

 

VS2017配置OpenCV3.4.5

1、系统变量:添加变量名:Path

变量值:D:\ProgramFiles\opencv\build\x64\vc15\bin

 

2、用户变量:添加变量名:PATH(有就不需要添加,但是值需要添加)D:\ProgramFiles\opencv\build

D:\ProgramFiles\opencv\build\x64\vc15\bin

 

3、打开VS2017,新建一个项目,将x86改为x64,进行下一步配置;视图->其他窗口->属性管理器(双击Microsoft.Cpp.x64.user)

(1)包含目录

D:\ProgramFiles\opencv\build\include

D:\ProgramFiles\opencv\build\include\opencv

D:\ProgramFiles\opencv\build\include\opencv2

(2)库目录

D:\ProgramFiles\opencv\build\x64\vc15\lib

(3)附加依赖项

接着,选择C/C++->常规,附加包含目录中添加

D:\ProgramFiles\opencv\build\include

然后选择链接器->输入 ,在附加依赖项添加D:\ProgramFiles\opencv\build\x64\vc15\lib\opencv_world345d.lib

你可能感兴趣的:(图像旋转)