Home >Backend Development >C++ >How to Configure OpenCV-2.3 with Visual Studio 2010?
Configuring OpenCV-2.3 for Visual Studio 2010
While the official guide focuses on installing OpenCV-2.1, this article provides comprehensive instructions for properly setting up OpenCV-2.3 (x86 version) in Visual Studio 2010 (Express).
Setup Steps:
#include <stdio.h> #include <cv.h> #include <highgui.h> int main(int argc, char* argv[]) { if (argc < 2) { printf("Usage: ./opencv_hello <file.png>\n"); return -1; } IplImage* img = cvLoadImage(argv[1], CV_LOAD_IMAGE_UNCHANGED); if (!img) { return -1; } cvNamedWindow("display", CV_WINDOW_AUTOSIZE); cvShowImage("display", img); cvWaitKey(0); return 0; }
Configure Include Directories: In Project Properties > C/C > General, add these paths to Additional Include Directories:
Configure Library Directories: In Project Properties > Linker > General, add this path to Additional Library Directories:
Link OpenCV Libraries: In Project Properties > Linker > Input, add the following libraries:
Set PATH Environment Variable: Append the following path to your PATH environment variable:
Execution:
Press F7 to build the solution. Ensure it succeeds without errors. To execute the application, make sure the PATH modification is applied and you can run OpenCV commands directly from the command prompt.
The above is the detailed content of How to Configure OpenCV-2.3 with Visual Studio 2010?. For more information, please follow other related articles on the PHP Chinese website!