Haven_zhf

如果你是房间里那个最聪明的人,那么你走错房间了。

导航

vs2012中opencv的安装与配置、编辑器的配色方案

配置:win10专业版

vs2012专业版的下载参考网站:

http://www.nocang.com/visual-studio-professional-2012/

开发环境配置参考网站:

http://blog.csdn.net/dcrmg/article/details/51809614

配置完后,测试代码:(http://blog.csdn.net/panshun888/article/details/53039294)

 1 //#include "stdafx.h"  
 2 //#include "..//stdafx.h"
 3 #include <tchar.h> 
 4 #include <iostream>    
 5 #include<core/core.hpp>    
 6 #include<highgui/highgui.hpp>   
 7 using namespace cv;  
 8 using namespace std;  
 9 int _tmain(int argc, _TCHAR* argv[])  
10 {  
11     //读入图片,注意图片路径    
12     Mat image = imread("D:\\boy.png");  
13     //图片读入成功与否判定    
14     if (!image.data)  
15     {  
16         cout << "you idiot!where did you hide boy!" << endl;  
17         //等待按键    
18         system("pause");  
19         return -1;  
20     }  
21     //创建一个名字为“Lena”的图像显示窗口,(不提前声明也可以)    
22     namedWindow("boy", 1);  
23     //显示图像    
24     imshow("boy", image);  
25     //等待按键    
26     waitKey();  
27     return 0;  
28       
29 }  

 

编译出现以下错误:

无法打开包括文件:“stdafx.h”: No such file or directory

解决方案:去掉#include <stdafx.h>,一般出MFC工程外,都不使用预编译头。(http://blog.csdn.net/zhenyusoso/article/details/7900742)

这个问题解决后,又一个问题是:

error C2061: 语法错误: 标识符“_TCHAR

解决方案:添加头文件:#include <tchar.h> (http://blog.csdn.net/u012424783/article/details/37606355)

好了,配置和测试都到这吧。迈开了opencv的第一步。

 

关于visual studio2012配色方案:

  可以上https://studiostyl.es/,下载一个方案。

导入步骤: 工具------------导入和导出设置------------导入选定的环境设置------------否,仅导入新设置------------然后“浏览”选刚  

  刚下载的vssetings文件------------完成。

 

posted on 2017-09-14 20:31  Haven_zhf  阅读(342)  评论(0编辑  收藏  举报