æ¥éª¤1: é¦å
éè¦ä¸è½½openCVï¼è¿æ¯Sourceforgeçé¾æ¥
http://sourceforge.net/projects/opencvlibrary/æ¥éª¤2: å®è£
openCVå°èªå®ä¹ç®å½ä¸ï¼å®è£
çè¿ç¨ä¸ç³»ç»ä¼èªå¨è®¾ç½®openCVçç¯å¢åéã
æ¥éª¤3: å®è£
å®æ¯åéè¦æ工设置ä¸ä¸ç¯å¢åéï¼æD:\CodeLibrary\opencv
\build\x64\vc11\binæ·»å å°ç³»ç»åé-->Pathä¸ï¼å
¶ä¸D:\CodeLibrary\opencvæ¯openCVçå®è£
ç®
å½ï¼è¿éæ ¹æ®èªå·±çç®å½è¿è¡ä¿®æ¹ãå¦å¤ï¼å¦ææ¯32ä½çæä½ç³»ç»å°±æx64æ¹æx86ã
æ¥éª¤4: æå¼Visual Studio 2012å建ä¸ä¸ªVisual C++çä¸ä¸ªæ°ç空项ç®ã
æ¥éª¤5: å³é®ç¹å» [解å³æ¹æ¡èµæºç®¡çå¨] ä¸ç解å³æ¹æ¡ç»ç¹ï¼éæ© [é
置管çå¨]ã
æ¥éª¤6: å¨ [æ´»å¨è§£å³æ¹æ¡å¹³å°(P)] ä¸éæ©x64ï¼å 为æç¨çæ¯64ä½çæä½ç³»ç»ï¼ï¼åå¦æ²¡æx64å¯éåéæ©<æ°å»º ...>ï¼å¨ [é®å
¥æéæ©æ°å¹³å°(P)] ä¸éæ©x64ç¶åç¹ [ç¡®å®]ï¼ç¶åå
³é [é
置管çå¨]
æ¥éª¤7ï¼å³é®ç¹å»æ°å»ºç项ç®ï¼éæ© [å±æ§]ï¼æå¼å±æ§çªå£ï¼ç¶åå¨ [é
ç½®å±æ§] ä¸éæ© [VC++ç®å½]ï¼ç¼è¾å³è¾¹ç [å
å«ç®å½]ï¼
æD:\CodeLibrary\opencv\build\includeï¼D:\CodeLibrary\opencv\build\include
\opencvï¼D:\CodeLibrary\opencv\build\include\opencv2 è¿ä¸ä¸ªç®å½æ·»å è¿å»ãè¿æ ·ç¨includeæ·»å openCVç头æ件çæ¶åæä¸ä¼åºéæ¾ä¸å°æ件ã
æ¥éª¤8ï¼ç¼è¾å³è¾¹ç [åºç®å½]ï¼æopenCVåºå½æ°çè·¯å¾
D:\CodeLibrary\opencv\build\x64\vc11\libæ·»å è¿å»ï¼æ³¨æå°Visual Studio
2012éè¦ä½¿ç¨vc11è¿ä¸ªç®å½ï¼èä¸åæ¯vc10ï¼èä¸å¯¹åºæ¯64ä½çæä½ç³»ç»æ以éæ©x64è¿ä¸ªç®å½ï¼ã让Visual
Studioå¨ç¼è¯ç¨åºçæ¶åï¼è½å¤æç´¢å°è¿ä¸ªç®å½ä»¥è°ç¨openCVçå½æ° ã
æ¥éª¤9ï¼éæ©å·¦è¾¹ç [é¾æ¥å¨]ï¼åéæ© [è¾å
¥]ï¼ä¿®æ¹å³è¾¹ç [éå ä¾èµé¡¹] æD:\CodeLibrary
\opencv\build\x64\vc11\libç®å½ä¸çææ以*.lib为æ©å±åçæ件åæ·»å è¿å»ï¼ä»¥æ·»å libæ件(æ¥éª¤8æ¯æ·»å åºå½æ°çæç´¢
ç®å½ï¼è¿ä¸æ¥æ¯æ·»å å
·ä½çlibæ件ãï¼å¨è¿é以dç»å°¾çæ件对åºdebug模å¼ï¼èä¸æ¯ä»¥dç»å°¾çæ件对åºrelease模å¼ï¼ä¸ºäºæ¹ä¾¿èµ·è§ï¼ææå®ä»¬
å
¨é¨å è¿å»äºã
æ¥éª¤10ï¼ç°å¨å·²ç»å®æäºopenCVçé
ç½®ï¼è¿è¡ä¸ä¸ä¸ä¸ªç®åç读å¾åçç¨åºä½ä¸ºæµè¯ï¼å¯ä»¥çå°å¾åè½æåæ¾ç¤ºï¼æä»»æé®å¯ç»æç¨åºã
éä¸ç¨äºæµè¯ç代ç ï¼
#include<stdio.h>
#include"highgui.h"
int main(int argc, char** argv){
IplImage *img = cvLoadImage("E:\\2.jpg"); //cvLoadImage()çåæ°ä¸ºå¾ççå®æ´è·¯å¾å
cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE);
cvShowImage("Example1",img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Example1");
return 0;
}