Presentation is loading. Please wait.

Presentation is loading. Please wait.

How to import libraries into Visual Studio OpenCV.

Similar presentations


Presentation on theme: "How to import libraries into Visual Studio OpenCV."— Presentation transcript:

1 How to import libraries into Visual Studio OpenCV

2 Go to My Computer>Local Disk (C:) and create a folder for your opencv I just named mine opencv245 (the 245 is the version number)

3 Copy the contents of the OpenCV you downloaded and paste them into the folder you just created in the C: directory

4 Next go to My Computer>System Properties>Advanced System Settings>Environment Variables Click the New button and enter a variable name (You can name it whatever you want but just make sure that in the later steps you put the correct name) For variable value put the path you just created for the build of the libraries C:\opencv245\build

5 Next scroll down the system variables list until you find Path and hit edit In the variable value make sure you enter a semi-colon( ; ) before you add a path. What you are going to enter is %OPENCV_BUILD%\x86\vc10\bin; (The OPENCV_BUILD is whatever you named the variable in the previous slide) This is where the library functions are.

6 Create your project in visual studio, you should see these tabs at the bottom left of your screen (if the tabs don’t show, go to tools, settings, and select expert settings) Click on the tab that says Property Manager

7 Drop down the library tab and the Debug tab Right click on Debug and go to Add New Project Property Sheet This should pop up so name your new sheet and click add at the bottom.

8 Once you add your new sheet in, it will show up under the Debug |Win32 tab so right click and select Properties You will get this window. Drop down the C/C++ and Click on General. At the top there is an Additional Include Directories. Click on that and select edit

9 Click the New Line Button and enter the system variable you created (in this example we created one named OPENCV_BUILD which contains the value of c:\opencv245\build (Where the libraries are at) You are going to enter $(whatever you named it)\include **This will allow you to select the libraries in the #include when writing your code** This is what it should look like once you hit OK.

10 Next you are going to go under Linker and click on General. Go to the Additional Library Directories and click edit. This will be a little different than what we did for the C/C++ General because we will be setting a different path that actually leads to where the library files are.

11 Click the new line button and add $(OPENCV_BUILD)\x86 \vc10\lib **This is what contains all the library files**

12 Next go to Input under Linker and click Edit under Additional Dependencies

13 You can find the libraries that you need to add by going to C:\opencv245\build\x86\vc1lib You want to add the ones that end with a d before the.lib (opencv_calib245d.lib) Here is a list that you can copy and paste so you don’t have to write them all: opencv_core245d.lib opencv_features2d245d.lib opencv_flann245d.lib opencv_gpu245d.lib opencv_haartraining_engined.lib opencv_highgui245d.lib opencv_imgproc245d.lib opencv_legacy245d.lib opencv_ml245d.lib opencv_nonfree245d.lib opencv_objdetect245d.lib opencv_photo245d.lib opencv_stitching245d.lib opencv_superres245d.lib opencv_ts245d.lib opencv_video245d.lib opencv_videostab245d.lib

14 When you do #include and start typing for opencv, the two folders should show up and from there you can select the libraries you want to include.

15 In order to avoid going through this whole process again locate the.props file you just created (mine is in Visual Studio 2010\projects\opencvproject\opencvproject Copy that file into someplace that will be easy for you to navigate to whenever you want to start a new opencv project.

16 Now for any new opencv project you create, when you go to the Property Manager tab, right click and choose Add Existing Property Sheet and find the one we created. That’s it! :D


Download ppt "How to import libraries into Visual Studio OpenCV."

Similar presentations


Ads by Google