Configuring OpenCV Library in Microsoft Visual Studio Environment
I have a plan to change my compiler to Visual Studio because I want to use OpenMP in the near future. However, my dream is to write machine vision algorithm that is platform-dependent, it can work with any image grabbing cards, any camera and runs at any OSs (this one might not too important for now).
Although many programmers have posted these tips, I still want to post this kind of information so that when I need to re-configure my Visual Studio I can find these steps easily, from my own blog.
First thing you need to do is go to the project setting:
We need to tell Visual Studio which directory to the include files of OpenCV, we can do this by choosing the "Additional Include Directories"
Then, choose the General part of Linker tab in the Project settings and add the additional library directory:
Then the last step is to add the additional dependency on the Input part of Linker tab and add these values.
Then, to test whether this this settings is correct or not, you can create a simple project like this:
#include
#include
#include
int main(int argc, char ** argv)
{
const char* filename = argc >=2 ? argv[1] : "C:\\Users\\mario\\Desktop\\vc++\\testsaveimage\\debug\\1.JPG";
IplImage * im;
im = cvLoadImage( filename, CV_LOAD_IMAGE_GRAYSCALE );
if( !im )
return -1;
cvNamedWindow("win", 0); cvShowImage("win", im);
}
Try to build this project and see whether you have an error message or not.
Good luck.
Labels: fun, opencv, visual c++
0 Comments:
Post a Comment
<< Home