Install OpenCV in windows


Step-1 : Copy all the following files in D drive
  • MinGW(folder)
  • OpenCV
  • cmake-2.8.12.2-win32-x86.exe
Step-2: Set Enviroment path of D:\OpenCV\MinGW\bin
Step-3: Run exe cmake-2.8.12.2-win32-x86.exe and give the source path of openCV
and destination path (Create a new folder in give the path of that folder)
Step-4: Click on configure button
Step-5: Click on generate button
Step-6: Open CMD prompt and go to the destination path  that configure at the time of  Run exe cmake-2.8.12.2-win32-x86.exe.
Step-7: now Type minGW32-make. press enter.
Step-8: Set enviroment variable path of generated bin folder. D:\OpenCV\OpenCV Build\bin.
Step-9: Install Eclipse and then open new C++ project.
Step-10: File->New->Project->C++ Project->(Next)->[Project Type]Helloworld C++ Project, [Toolchains] MinGW GCC and write project name–>(Finish)
Step-11: Click on created project folder in eclipse Project explorer window
and then go to Project Tab from Top menu–>Properties–>c/C++ Build-->Setting
Then Go To Tool Setting Tab –>GCC C++ Compilar –> Include –> Write the include folder path of OpenCV eg:D:\OpenCV\OpenCV\Windows\opencv\build\include –>MinGW C++ Linker –>Libraries –> Copy the name of all DLL Files from the build folder and paste in Linraries pane eg: D:\OpenCV\OpenCV_Build\lib–> and copy the path D:\OpenCV\OpenCV_Build\lib and paste in Library search path Pane–>Then Apply and OK
Step-12: Now run the Test Code
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
int main() {
Mat image = imread("C:/Users/myuser/Desktop/imag.jpg",CV_LOAD_IMAGE_COLOR);
 Mat image1 = image+Scalar(10,200,200);
 imshow("display", image1);
 waitKey(0);
 return 0;
}

Comments