SQL Server2008的安装,SQLServer2008的安装......
2023-02-22 277 安装
这里介配置opencv的方式非常的方便省去了很多步骤,对于快速想要实现opencv开发的人来说,环境配置这一关很容易通过
下载 安装Opencv 2.4.8 我安装在D:/Program Files中
在系统变量里面新建变量,名为OPENCV,值为自己解压opencv路径下的build路径,如D:Program Filesopencvbuild。
在系统变量里面编辑Path变量,在末尾添加;%OPENCV%x86vc12bin。
在opencv根目录(例如D:Program Filesopencv)下新建VS属性表文件opencv248.props,或者直接下载我的opencv248.props属性表文件。
opencv248.props 文件内容如下:
文本代码为:
?xmlversion="1.0"encoding="utf-8"?>
ProjectToolsVersion="4.0"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
ImportGroupLabel="PropertySheets"/>
PropertyGroupLabel="UserMacros"/>
PropertyGrou
IncludePath>$(OPENCV)include;$(IncludePath)/IncludePath>
LibraryPathCondition="'$(Platform)'=='Win32'">$(OPENCV)x86vc12lib;$(LibraryPath)/LibraryPath>
LibraryPathCondition="'$(Platform)'=='X64'">$(OPENCV)x64vc12lib;$(LibraryPath)/LibraryPath>
/PropertyGrou
ItemDefinitionGrou
LinkCondition="'$(Configuration)'=='Debug'">
AdditionalDependencies>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;%(AdditionalDependencies)/AdditionalDependencies>
/Link>
LinkCondition="'$(Configuration)'=='Release'">
AdditionalDependencies>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;%(AdditionalDependencies)/AdditionalDependencies>
/Link>
/ItemDefinitionGrou
ItemGroup/>/Project>
新建VS测试工程
文件 -> 新建 -> 项目 -> Visual C -> Win32 控制台应用程序(输入名称test)->确定 -> 下一步 -> 附加选项选“空项目” -> 完成
这里用VS属性表的方式将Opencv配进工程,每次只需要添加属性表即可完成配置,比手工界面配置方便很多。
属性管理器 -> 右键 "test"(工程名) -> 添加现有属性表
测试
解决方案资源管理器 -> 源文件(右键)-> 添加 -> 新建项
测试代码如下:
#includeopencv2opencv.hp#includeiostream>#includestring>usingnamespacecv;usingnamespacestd;intmain(){
Matimg=imread("pps.jpg");
if(img.empty())
{
cout"error";
return-1;
}
imshow("pp的靓照",img);
waitKey();
return0;}
是否出现自己的那张pps.jpg的照片
以上方法由办公区教程网编辑摘抄自百度经验可供大家参考!
相关文章