1. Download & Execute
http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.1/2. Create Project
New > Win32 Console Application > Console Application
3. Add Path
3-1. Include
Project Property > Configuration Property (構成プロパティ) > C/C++ > General > Add Include Directory
- C:\OpenCV2.1\include;
3-2. Lib
Project Property > Configuration Property (構成プロパティ) > Linker > General > Add Library Directory
- C:\OpenCV2.1\Lib
3-3. Add Lib
Project Property > Configuration Property (構成プロパティ) > Linker > Output
cv210.lib
highgui210.lib
cxcore210.lib
cvaux210.lib
3-* Error occur if i set fellows
Project Property -> Configuration Property (構成プロパティ) -> ; VC++ Directory
- Include C:\OpenCV2.1\include;
- Lib C:\OpenCV2.1\lib;
4. Build & Debug Sample Code
#include "stdafx.h"
#include
#include
#include
#include
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "Hello OpenCV" << std::endl;
const char* fileName = "C:\\OpenCV2.1\\samples\\c\\box_in_scene.png";
const char* windowName = "Sample - Sample";
//View Image
try{
//Load Image File
::IplImage* img = :: cvLoadImage(fileName);
if(img==0){
std::cout << "can't open file" << std::endl;
return -1;
}
//View Image File
::cvNamedWindow(windowName);
::cvShowImage(windowName, img);
//Close Window
::cvWaitKey();
::cvDestroyWindow(windowName);
//Release Window
::cvReleaseImage(&img);
}
catch(std::exception& ex){
std::cout << ex.what() << std::endl;
}
return 0;
}
0 件のコメント:
コメントを投稿