OpenCV 2.4 and MinGW Setup on Windows 7
To utilize OpenCV 2.4 with MinGW on Windows 7, follow these steps:
OpenCV Installation:
MinGW Installation:
Sample Program:
#include "opencv2/highgui/highgui.hpp" #include <iostream> using namespace cv; using namespace std; int main(int argc, char** argv) { Mat im = imread(argc == 2 ? argv[1] : "lena.jpg", 1); if (im.empty()) { cout << "Cannot open image!" << endl; return -1; } imshow("image", im); waitKey(0); return 0; }
g++ -I"C:\opencv\build\include" -L"C:\opencv\build\x86\mingw\lib" loadimg.cpp -lopencv_core243 -lopencv_highgui243 -o loadimg
You'll now have a working OpenCV and MinGW setup on Windows 7. Explore OpenCV's samples directory for further examples and documentation.
The above is the detailed content of How to Set Up OpenCV 2.4 with MinGW on Windows 7?. For more information, please follow other related articles on the PHP Chinese website!