- CMake http://www.cmake.org/
- MinGW with MSYS http://www.mingw.org/
- OpenCV source code http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.2/
- Eclipse CDT http://www.eclipse.org/cdt/
- Open MSYS and go to OpenCV folder
cd C:/c-dev/OpenCV-2.2.0
- Run CMake command to generate "Build files"
cmake -G "Unix Makefiles" .
- Build OpenCV
make make install
- Add bin directory to your PATH
C:\c-dev\OpenCV-2.2.0\bin
- Create new project
- Add header path
- Add library path
- Add libraries
Time to code
#include <iostream>
#include "opencv2/opencv.hpp"
int main(int argc, char** argv) {
cout << "Hello OpenCV" << endl;
IplImage* img = cvLoadImage("lena.jpg", CV_LOAD_IMAGE_COLOR);
if (img) {
cvShowImage("Hello OpenCV", img);
cvWaitKey(0);
cvDestroyAllWindows();
}
return 0;
}




No comments:
Post a Comment