Getting Started
To install OpenCV 2.4.3, begin by downloading the self-extracting archive from its official repository. Once extracted, it will create a directory where all the required files are located.
System Configuration
To use OpenCV effectively, add the directory containing OpenCV's DLLs to your system's PATH variable. This directory, located at C:opencvbuildx86vc10bin, is where the necessary libraries reside.
Visual C Setup
Configure Visual C 's include and library directories to match OpenCV's corresponding directories:
Add the following additional dependencies to your project's linker:
opencv_calib3d243d.lib opencv_contrib243d.lib opencv_core243d.lib ... opencv_videostab243d.lib
Example Code
To test your setup, create a new source file and enter the following code:
#include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main() { // Load an image Mat im = imread("c:/full/path/to/lena.jpg"); if (im.empty()) { cout << "Cannot load image!" << endl; return -1; } // Display the image imshow("Image", im); waitKey(0); }
Compile and run the code using F5, and a window should appear displaying the loaded image.
Next Steps
Once OpenCV is integrated into your development environment, explore its samples and documentation to expand your knowledge and begin creating computer vision applications with ease.
The above is the detailed content of How to Install and Use OpenCV 2.4.3 in Visual C 2010 Express?. For more information, please follow other related articles on the PHP Chinese website!