search
HomeDatabaseMysql TutorialVS2010+OpenCV2.4.5详细配置方法

这称为摘要:按照之前网上各种方法在VS中添加OpenCV的时候,总是出现各种问题,现在把本人配置的方法和遇见的问题及解决方案予以分享。 本人电脑配置:VS2010,OpenCV2.4.5 1.准备:已安装VS2010,已下载OpenCV并且解压完毕,本机解压到 C:\CVLib\ 目录下(解

这称为摘要:按照之前网上各种方法在VS中添加OpenCV的时候,总是出现各种问题,现在把本人配置的方法和遇见的问题及解决方案予以分享。

本人电脑配置:VS2010,OpenCV2.4.5


1.准备:已安装VS2010,已下载OpenCV并且解压完毕,本机解压到C:\CVLib\目录下(解释下:然后下级目录就是opencv,再下面就是3rdparty、build、include等文件夹了,及得安装的时候一定把下面所有出现的目录都改成自己文件夹的目录)。

2.配置环境变量:我的电脑->(右键)属性->高级->环境变量->(双击)path(用户,系统里面的path任选其一)->在变量path里添加C:\CVLib\opencv\build\x86\vc10\bin”,当然记得把C:\CVLib\opencv改成自己文件夹的目录。

3.建工程

3.1用VS2010建工程,控制台程序(CVTest).如图1,选“空项目”,完成,如图2,

VS2010+OpenCV2.4.5详细配置方法


                                       图1


VS2010+OpenCV2.4.5详细配置方法



                                           图2

3.2源文件->添加->新建项,如图3,选VC++--->C++源文件(test),如图4

VS2010+OpenCV2.4.5详细配置方法



                         图3

VS2010+OpenCV2.4.5详细配置方法


                   图4

4.配置(这是重点)

进入,项目->属性页->配置属性->VC++目录,如图5

VS2010+OpenCV2.4.5详细配置方法


                                                  图5

4.1包含目录,把目录"C:\CVLib\opencv\build\include"和C:\CVLib\opencv\build\include\opencv”和C:\CVLib\opencv\build\include\opencv2”三项都添加进去

添加进去(C:\CVLib\opencv改为自己的目录),如图6

VS2010+OpenCV2.4.5详细配置方法


图6

4.2 库目录,把目录"C:\CVLib\opencv\build\x86\vc10\lib"添加进去(C:\CVLib\opencv改为自己的目录),如图7

VS2010+OpenCV2.4.5详细配置方法


                       图7

4.3配置连接器,属性页->配置属性->连接器->输入->附加依赖项,,如图8

针对debug配置添加以下库:(对于不同版本的OpenCV ,此处代码约有不同,下面命名中的245,代表你所用OpenCV的版本号,2.4.5即为245,以此类推)

opencv_calib3d245d.lib

opencv_contrib245d.lib

opencv_core245d.lib

opencv_features2d245d.lib

opencv_flann245d.lib

opencv_gpu245d.lib

opencv_highgui245d.lib

opencv_imgproc245d.lib

opencv_legacy245d.lib

opencv_ml245d.lib

opencv_objdetect245d.lib

opencv_ts245d.lib

opencv_video245d.lib

如果是release配置(以后再说,只需要添加上面的debug配置就行了现在),则添加:

opencv_calib3d245.lib

opencv_contrib245.lib

opencv_core245.lib

opencv_features2d245.lib

opencv_flann245.lib

opencv_gpu245.lib

opencv_highgui245.lib

opencv_imgproc245.lib

opencv_legacy245.lib

opencv_ml245.lib

opencv_objdetect245.lib

opencv_ts245.lib

opencv_video245.lib

VS2010+OpenCV2.4.5详细配置方法


图8

4.4至此,配置完成,但是每一次建工程都要重复以上4.1,4.2,4.3操作,编译器不会记住这些设置(这个比较蛋疼)。。。

5.结果

5.1可以写代码了,在刚才的test 中添加如下代码

 #include <opencv2>
 #include <iostream>
 #include <string>
 using namespace cv;
 using namespace std;
 int main()
 {   
	const char *name="girl.jpg";
        cout<span>代码中girl.jpg 换成自己图片的名字,放到当前工程下,和Debug文件夹并列存在同一目录下</span>
<p><span><span>5.2结果如图9</span></span></p>
<p><span><span><img  src="/static/imghwm/default1.png" data-src="/inc/test.jsp?url=http%3A%2F%2Fimg.blog.csdn.net%2F20130618160801218&refer=http%3A%2F%2Fblog.csdn.net%2Fu011056389%2Farticle%2Fdetails%2F9120231" class="lazy" alt="VS2010+OpenCV2.4.5详细配置方法" ><br>
</span></span></p>
<p><span><span><img src="" alt=""><br>
</span></span></p>
<p><span><span>                                                                    图9</span></span></p>
<p><span><span>常见问题: 1.没有找到opencv_core235d.dll,因此这个应用程序未能启动。重新安装应用程序可能会修复此问题。  解决方案:<span> </span><span>http://blog.sina.com.cnhttp://blog.sina.com.cn/s/blog_7d26e71401014ii1.html/s/blog_7d26e71401014ii1.htm</span>
       </span></span></p>
<p><br>
<span><span>2. LINK : fatal error LNK1104: 无法打开文件“opencv_calib3d231d.lib;” 解决方案:</span></span></p>


<p><span><span>http://blog.csdn.net/ustcxjt/article/details/7496101<br>
</span></span></p>
<p><span><span><span></span></span></span></p>
<p><span><span>参考资料:1.<span> </span><span>http://www.cnblogs.com/freedomshe/archive/2012/04/25/2470540.html</span></span></span></p>
<p><span>            2.http://blog.sina.com.cn/s/blog_7d26e71401014ii1.html</span></p>
<p><span><span>3.http://blog.csdn.net/ustcxjt/article/details/7496101</span></span></p>
<p><br>
</p>
<p><span>    </span></p>
<p><br>
</p>
<p><span><span><br>
</span></span></p>


</string></iostream></opencv2>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How Do I Drop or Modify an Existing View in MySQL?How Do I Drop or Modify an Existing View in MySQL?May 16, 2025 am 12:11 AM

TodropaviewinMySQL,use"DROPVIEWIFEXISTSview_name;"andtomodifyaview,use"CREATEORREPLACEVIEWview_nameASSELECT...".Whendroppingaview,considerdependenciesanduse"SHOWCREATEVIEWview_name;"tounderstanditsstructure.Whenmodifying

MySQL Views: Which design patterns can I use with it?MySQL Views: Which design patterns can I use with it?May 16, 2025 am 12:10 AM

MySQLViewscaneffectivelyutilizedesignpatternslikeAdapter,Decorator,Factory,andObserver.1)AdapterPatternadaptsdatafromdifferenttablesintoaunifiedview.2)DecoratorPatternenhancesdatawithcalculatedfields.3)FactoryPatterncreatesviewsthatproducedifferentda

What Are the Advantages of Using Views in MySQL?What Are the Advantages of Using Views in MySQL?May 16, 2025 am 12:09 AM

ViewsinMySQLarebeneficialforsimplifyingcomplexqueries,enhancingsecurity,ensuringdataconsistency,andoptimizingperformance.1)Theysimplifycomplexqueriesbyencapsulatingthemintoreusableviews.2)Viewsenhancesecuritybycontrollingdataaccess.3)Theyensuredataco

How Can I Create a Simple View in MySQL?How Can I Create a Simple View in MySQL?May 16, 2025 am 12:08 AM

TocreateasimpleviewinMySQL,usetheCREATEVIEWstatement.1)DefinetheviewwithCREATEVIEWview_nameAS.2)SpecifytheSELECTstatementtoretrievedesireddata.3)Usetheviewlikeatableforqueries.Viewssimplifydataaccessandenhancesecurity,butconsiderperformance,updatabil

MySQL Create User Statement: Examples and Common ErrorsMySQL Create User Statement: Examples and Common ErrorsMay 16, 2025 am 12:04 AM

TocreateusersinMySQL,usetheCREATEUSERstatement.1)Foralocaluser:CREATEUSER'localuser'@'localhost'IDENTIFIEDBY'securepassword';2)Foraremoteuser:CREATEUSER'remoteuser'@'%'IDENTIFIEDBY'strongpassword';3)Forauserwithaspecifichost:CREATEUSER'specificuser'@

What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!