无为清净楼资源网 Design By www.qnjia.com

Opencv是一个使用起来非常方便的开放视觉库。本文详细讲解如何在Win8.1+Visual Studio 2013环境下配置Opencv2.4.10

工具:Opencv2.4.10

方法/步骤:

这里用的Opencv版本是2.4.10,可以在Opencv的官网上免费下载。软件大小约为350M。

Visual Studio 2013+OpenCV2.4.10环境搭建教程

下载完毕后,双击打开“opencv-2.4.10”,选择解压目录。我这里选择解压目录为D盘。确认解压目录后,点击“Extract“。解压完成后,在opencv文件夹中生成两个文件夹。

Visual Studio 2013+OpenCV2.4.10环境搭建教程

Visual Studio 2013+OpenCV2.4.10环境搭建教程Visual Studio 2013+OpenCV2.4.10环境搭建教程

配置环境变量,这里用的是Win8.1专业版。控制面板-系统和安全-系统-高级系统设置,在打开的系统属性对话框中,选择”高级“,”环境变量“,在用户变量中点击”新建“,变量名:OPENCV,变量值:D:\opencv\build

Visual Studio 2013+OpenCV2.4.10环境搭建教程Visual Studio 2013+OpenCV2.4.10环境搭建教程

在用户变量中选择“path”,在其末尾添值;D:\opencv\build\x86\vc12\bin(注意有分号)。到此环境变量配置完毕。重启电脑或注销电脑,使环境变量生效。

Visual Studio 2013+OpenCV2.4.10环境搭建教程

接下来在Visual Studio 2013进行配置。打开Visual Studio 2013,文件—新建—项目,选择"Visula C++"—"Win32控制台应用程序".(向导中选择空项目)

Visual Studio 2013+OpenCV2.4.10环境搭建教程

打开记事本,将以下内容保存成“opencvdebug.props”。

<"1.0" encoding="utf-8""4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>

<IncludePath>D:\opencv\build\include;D:\opencv\build\include\opencv;D:\opencv\build\include\opencv2;$(IncludePath)</IncludePath>
<LibraryPath>D:\opencv\build\x86\vc12\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>opencv_ml2410d.lib;opencv_calib3d2410d.lib;opencv_contrib2410d.lib;opencv_core2410d.lib;opencv_features2d2410d.lib;opencv_flann2410d.lib;opencv_gpu2410d.lib;opencv_highgui2410d.lib;opencv_imgproc2410d.lib;opencv_legacy2410d.lib;opencv_objdetect2410d.lib;opencv_ts2410d.lib;opencv_video2410d.lib;opencv_nonfree2410d.lib;opencv_ocl2410d.lib;opencv_photo2410d.lib;opencv_stitching2410d.lib;opencv_superres2410d.lib;opencv_videostab2410d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>

</ItemDefinitionGroup>

<ItemGroup />

</Project>

Visual Studio 2013+OpenCV2.4.10环境搭建教程

打开记事本,将以下内容保存成“opencvrelease.props”。

<"1.0" encoding="utf-8""4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IncludePath>D:\opencv\build\include;D:\opencv\build\include\opencv;D:\opencv\build\include\opencv2;$(IncludePath)</IncludePath>

<LibraryPath>D:\opencv\build\x86\vc12\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>

<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>opencv_objdetect2410.lib;opencv_ts2410.lib;opencv_video2410.lib;opencv_nonfree2410.lib;opencv_ocl2410.lib;opencv_photo2410.lib;opencv_stitching2410.lib;opencv_superres2410.lib;opencv_videostab2410.lib;opencv_calib3d2410.lib;opencv_contrib2410.lib;opencv_core2410.lib;opencv_features2d2410.lib;opencv_flann2410.lib;opencv_gpu2410.lib;opencv_highgui2410.lib;opencv_imgproc2410.lib;opencv_legacy2410.lib;opencv_ml2410.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

<ItemGroup />

</Project>

Visual Studio 2013+OpenCV2.4.10环境搭建教程

在属性管理器中将之前保存的两个文件添加进去。到此配置完成。

Visual Studio 2013+OpenCV2.4.10环境搭建教程

在源文件中添加“源.cpp",并导入一张图片。在源文件中中输入一段代码测试。测试成功。

#include<cv.h>
#include<highgui.h>

int main(int argc, char** argv[])

{

IplImage* src = cvLoadImage("1.jpg",CV_LOAD_IMAGE_GRAYSCALE);
cvNamedWindow("Src", CV_WINDOW_AUTOSIZE);
cvShowImage("Src", src);
cvWaitKey(0);
cvReleaseImage(&src);
cvDestroyAllWindows();
return 0;

}

Visual Studio 2013+OpenCV2.4.10环境搭建教程

Visual Studio 2013+OpenCV2.4.10环境搭建教程

END

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

标签:
OpenCV,Visual,Studio,2013,OpenCV2.4.10

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。