Added the OpenCV with Visual Studio tutorial. Enhanced, extended the Windows Installa...
authorBernat Gabor <no@email>
Wed, 6 Jul 2011 00:01:27 +0000 (00:01 +0000)
committerBernat Gabor <no@email>
Wed, 6 Jul 2011 00:01:27 +0000 (00:01 +0000)
25 files changed:
doc/_themes/blue/static/default.css_t
doc/tutorials/introduction/windows_install/images/OpenCV_Install_Directory.png [new file with mode: 0644]
doc/tutorials/introduction/windows_install/images/PathEditorOpenCVInsertNew.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_install/images/PathEditorOpenCVSetPath.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_install/images/WindowsOpenCVDirPath.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_install/windows_install.rst
doc/tutorials/introduction/windows_visual_studio_Opencv/images/AddNewPropertySheet.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/NewProjectVisualStudio.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/OpenCVEditEnviromentVisual.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/OpenCV_Install_Directory.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertyPageAddExisting.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertyPageExample.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetInsideFolder.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVInclude.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLib.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesDebug.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesDebugSmple.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesRelease.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetVS2010.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/SuccessVisualStudioWindows.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/VCDirectories2008.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/images/VCDirectories2010.jpg [new file with mode: 0644]
doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.rst
samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/Test.cpp [new file with mode: 0644]
samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/opencv-logo.png [new file with mode: 0644]

index 679aaa3..0e60d0a 100644 (file)
@@ -325,7 +325,8 @@ margin-top: 0.2em;
  }
  
  .enumeratevisibleitemswithsquare p {
- margin-bottom: 0px;
+ margin-bottom: 0pt;
+ margin-top: 1pt;
  }
  
  .enumeratevisibleitemswithsquare dl{
diff --git a/doc/tutorials/introduction/windows_install/images/OpenCV_Install_Directory.png b/doc/tutorials/introduction/windows_install/images/OpenCV_Install_Directory.png
new file mode 100644 (file)
index 0000000..191aa3e
Binary files /dev/null and b/doc/tutorials/introduction/windows_install/images/OpenCV_Install_Directory.png differ
diff --git a/doc/tutorials/introduction/windows_install/images/PathEditorOpenCVInsertNew.jpg b/doc/tutorials/introduction/windows_install/images/PathEditorOpenCVInsertNew.jpg
new file mode 100644 (file)
index 0000000..95d1e45
Binary files /dev/null and b/doc/tutorials/introduction/windows_install/images/PathEditorOpenCVInsertNew.jpg differ
diff --git a/doc/tutorials/introduction/windows_install/images/PathEditorOpenCVSetPath.jpg b/doc/tutorials/introduction/windows_install/images/PathEditorOpenCVSetPath.jpg
new file mode 100644 (file)
index 0000000..197a2ac
Binary files /dev/null and b/doc/tutorials/introduction/windows_install/images/PathEditorOpenCVSetPath.jpg differ
diff --git a/doc/tutorials/introduction/windows_install/images/WindowsOpenCVDirPath.jpg b/doc/tutorials/introduction/windows_install/images/WindowsOpenCVDirPath.jpg
new file mode 100644 (file)
index 0000000..1c7182e
Binary files /dev/null and b/doc/tutorials/introduction/windows_install/images/WindowsOpenCVDirPath.jpg differ
index ea05671..761a7dc 100644 (file)
@@ -30,18 +30,17 @@ Installation by using the pre-built libraries
 \r
 #. Make sure you have admin rights. Start the setup and follow the wizard. Agree to the \" License Agreement \" . \r
 \r
-#. Adding the OpenCV library to the system path is a good decision unless you want to play around with multiple flavors of the same OpenCV version. You will use the OpenCV library in form of *\"Dynamic-link libraries\"* (also known as **DLL**). Inside these are stored all the algorithms and information the OpenCV library contains. The operating system will load them only on demand, during runtime. However, to do this he needs to know where they are. The systems **PATH** contains a list of folders where DLLs can be found. Add the OpenCV library path to this and the OS will know where to look if he ever needs the OpenCV binaries. Otherwise, you will need to copy the used DLLs right beside the applications executable file (*exe*) for the OS to find it. \r
-\r
-   .. note:: \r
-      A good and safe way to check your systems **PATH** folders is by using the \"*Path Editor*\" application. You can download it `from here <http://www.redfernplace.com/software-projects/patheditor/>`_. Use this if you are not sure the systems path was updated with the OpenCV entry. You can also add manually new folders to the systems **PATH** by using this application. \r
+#. While adding the OpenCV library to the system path is a good decision for a better control of this we will do it manually. Therefore, make sure you do not set this option. \r
 \r
 #. Most of the time it is a good idea to install the source files as this will allow for you to debug into the OpenCV library, if it is necessary. Therefore, just follow the default settings of the wizard and finish the installation. \r
 \r
-#. In the end you can check the installation at the chosen path. If you added the OpenCV Path to the system PATH inside the *Path Editor* you should see an entry with the *bin* folder of the OpenCV directory\r
+#. You can check the installation at the chosen path as you can see below\r
 \r
-.. image:: images/OpenCV_Install_Directory.jpg\r
-   :alt: An example of how the installation directory should look in case of success.\r
-   :align: center\r
+   .. image:: images/OpenCV_Install_Directory.jpg\r
+      :alt: An example of how the installation directory should look in case of success.\r
+      :align: center\r
+\r
+#. To finalize the installation go to the :ref:`WindowsSetPathAndEnviromentVariable` section. \r
 \r
 .. _CppTutWindowsMakeOwn: \r
 \r
@@ -234,9 +233,12 @@ Building the library
       \r
       .. code-block:: bash\r
          \r
-         setx QTDIR D:/OpenCV/dep/qt/qt-everywhere-opensource-src-4.7.3\r
+         setx -m QTDIR D:/OpenCV/dep/qt/qt-everywhere-opensource-src-4.7.3\r
+      \r
+      .. |PathEditor| replace:: Path Editor\r
+      .. _PathEditor: http://www.redfernplace.com/software-projects/patheditor/\r
       \r
-      Also, add the built binary files path to the system path by using the `Path Editor <http://www.redfernplace.com/software-projects/patheditor/>`_. In our case this is :file:`D:/OpenCV/dep/qt/qt-everywhere-opensource-src-4.7.3/bin`. \r
+      Also, add the built binary files path to the system path by using the  |PathEditor|_. In our case this is :file:`D:/OpenCV/dep/qt/qt-everywhere-opensource-src-4.7.3/bin`. \r
       \r
       .. note:: \r
       \r
@@ -335,9 +337,34 @@ Building the library
    .. note::\r
 \r
       If you use the GPU module (CUDA libraries) make sure you also upgrade to the latest drivers of your GPU. Error messages containing invalid entries in (or cannot find) the nvcuda.dll are caused mostly by old video card drivers. For testing the GPU (if built) run the *performance_gpu.exe* sample application.\r
-   \r
-   Now you can continue reading the tutorials with the :ref:`Windows_Visual_Studio_How_To` section. There you will find out how to use the OpenCV library in your own projects with the help of the Microsoft Visual Studio IDE. \r
 \r
+.. _WindowsSetPathAndEnviromentVariable:\r
+\r
+Set the OpenCV enviroment variable and add it to the systems path\r
+=================================================================\r
+\r
+First we set an enviroment variable to make easier our work. This will hold the install directory of our OpenCV library that we use in our projects. Start up a command window and enter:\r
+\r
+.. code-block:: bash\r
 \r
+   setx -m OPENCV_DIR D:\OpenCV\Build\Install\r
+\r
+Here the directory is where you have your OpenCV binaries (*installed* or *built*). Inside this you should have folders like *bin* and *include*. The -m should be added if you wish to make the settings computer wise, instead of user wise. \r
+\r
+If you built static libraries then you are done. Otherwise, you need to add the *bin* folders path to the systems path.This is cause you will use the OpenCV library in form of *\"Dynamic-link libraries\"* (also known as **DLL**). Inside these are stored all the algorithms and information the OpenCV library contains. The operating system will load them only on demand, during runtime. However, to do this he needs to know where they are. The systems **PATH** contains a list of folders where DLLs can be found. Add the OpenCV library path to this and the OS will know where to look if he ever needs the OpenCV binaries. Otherwise, you will need to copy the used DLLs right beside the applications executable file (*exe*) for the OS to find it, which is highly unpleasent if you work on many projects. To do this start up again the |PathEditor|_ and add the following new entry (right click in the application to bring up the menu):\r
+\r
+.. code-block:: bash\r
+\r
+   %OPENCV_DIR%\bin\r
+\r
+.. image:: images/PathEditorOpenCVInsertNew.jpg\r
+   :alt: Right click to insert new path manually. \r
+   :align: center\r
+   \r
+.. image:: images/PathEditorOpenCVSetPath.jpg\r
+   :alt: Add the entry. \r
+   :align: center\r
 \r
+Save it to the registry and you are done. If you ever change the location of your install directories or want to try out your applicaton with a different build all you will need to do is to update the OPENCV_DIR variable via the *setx* command inside a command window. \r
 \r
+Now you can continue reading the tutorials with the :ref:`Windows_Visual_Studio_How_To` section. There you will find out how to use the OpenCV library in your own projects with the help of the Microsoft Visual Studio IDE. \r
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/AddNewPropertySheet.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/AddNewPropertySheet.jpg
new file mode 100644 (file)
index 0000000..4ad0bad
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/AddNewPropertySheet.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/NewProjectVisualStudio.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/NewProjectVisualStudio.jpg
new file mode 100644 (file)
index 0000000..c02f203
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/NewProjectVisualStudio.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/OpenCVEditEnviromentVisual.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/OpenCVEditEnviromentVisual.jpg
new file mode 100644 (file)
index 0000000..6226c2b
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/OpenCVEditEnviromentVisual.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/OpenCV_Install_Directory.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/OpenCV_Install_Directory.jpg
new file mode 100644 (file)
index 0000000..6c6625a
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/OpenCV_Install_Directory.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertyPageAddExisting.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertyPageAddExisting.jpg
new file mode 100644 (file)
index 0000000..7e92c73
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertyPageAddExisting.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertyPageExample.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertyPageExample.jpg
new file mode 100644 (file)
index 0000000..bfe8614
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertyPageExample.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetInsideFolder.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetInsideFolder.jpg
new file mode 100644 (file)
index 0000000..5ece6c4
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetInsideFolder.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVInclude.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVInclude.jpg
new file mode 100644 (file)
index 0000000..136ddc7
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVInclude.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLib.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLib.jpg
new file mode 100644 (file)
index 0000000..484bba4
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLib.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesDebug.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesDebug.jpg
new file mode 100644 (file)
index 0000000..58c7880
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesDebug.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesDebugSmple.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesDebugSmple.jpg
new file mode 100644 (file)
index 0000000..fb8b2d9
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesDebugSmple.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesRelease.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesRelease.jpg
new file mode 100644 (file)
index 0000000..45b23eb
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetOpenCVLibrariesRelease.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetVS2010.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetVS2010.jpg
new file mode 100644 (file)
index 0000000..56f2c3f
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/PropertySheetVS2010.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/SuccessVisualStudioWindows.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/SuccessVisualStudioWindows.jpg
new file mode 100644 (file)
index 0000000..1043c41
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/SuccessVisualStudioWindows.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/VCDirectories2008.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/VCDirectories2008.jpg
new file mode 100644 (file)
index 0000000..d053c4f
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/VCDirectories2008.jpg differ
diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/images/VCDirectories2010.jpg b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/VCDirectories2010.jpg
new file mode 100644 (file)
index 0000000..dd898ed
Binary files /dev/null and b/doc/tutorials/introduction/windows_visual_studio_Opencv/images/VCDirectories2010.jpg differ
index ad1bf9f..2fc7f5a 100644 (file)
@@ -3,4 +3,161 @@
 How to build applications with OpenCV inside the *Microsoft Visual Studio*\r
 **************************************************************************\r
 \r
-One. 
\ No newline at end of file
+Everything I describe here will apply to the C\\C++ interface of OpenCV.\r
+I start out from the assumption that you have read and completed with success the :ref:`Windows_Installation` tutorial. Therefore, before you go any further make sure you have an OpenCV directory that contains the OpenCV header files plus binaries and you have set the environment variables as :ref:`described here <WindowsSetPathAndEnviromentVariable>`.\r
+\r
+.. image:: images/OpenCV_Install_Directory.jpg\r
+   :alt: You should have a folder looking like this.\r
+   :align: center\r
+\r
+The OpenCV libraries, distributed by us, on the Microsoft Windows operating system are in a **D**\ ynamic **L**\ inked **L**\ ibraries (*DLL*). These have the advantage that all the content of the library are loaded only at runtime, on demand, and that countless programs may use the same library file. This means that if you have ten applications using the OpenCV library, no need to have around a version for each one of them. Of course you need to have the *dll* of the OpenCV on all systems where you want to run your application. \r
+\r
+Another approach is to use static libraries that have *lib* extensions. You may build these by using our source files as described in the :ref:`Windows_Installation` tutorial. When you use this the library will be built-in inside your *exe* file.  So there is no chance that the user deletes them, for some reason. As a drawback your application will be larger one and as, it will take more time to load it during its startup.\r
+\r
+To build an application with OpenCV you need to do two things: \r
+\r
+.. container:: enumeratevisibleitemswithsquare\r
+\r
+  + *Tell* to the compiler how the OpenCV library *looks*. You do this by *showing* it the header files. \r
+  + *Tell* to the linker from where to get the functions or data structures of OpenCV, when they are needed. \r
+\r
+    If you use the *lib* system you must set the path where the library files are and specify in which one of them to look. During the build the linker will look into these libraries and add the definitions and implementation of all *used* functions and data structures to the executable file.\r
+\r
+    If you use the *DLL* system you must again specify all this, however now for a different reason. This is a Microsoft OS specific stuff. It seems that the linker needs to know that where in the DLL to search for the data structure or function at the runtime. This information is stored inside *lib* files. Nevertheless, they aren't static libraries. They are so called import libraries. This is why when you make some *DLLs* in Windows you will also end up with some *lib* extension libraries. The good part is that at runtime only the *DLL* is required.\r
+\r
+To pass on all this information to the Visual Studio IDE you can either do it globally (so all your future projects will get these information) or locally (so only for you current project). The advantage of the global one is that you only need to do it once; however, it may be undesirable to clump all your projects all the time with all these information. In case of the global one how you do it depends on the Microsoft Visual Studio you use. There is a **2008 and previous versions** and a **2010 way** of doing it. Inside the global section of this tutorial I'll show what the main differences are.\r
+\r
+The base item of a project in Visual Studio is a solution. A solution may contain multiple projects. Projects are the building blocks of an application. Every project will realize something and you will have a main project in which you can put together this project puzzle. In case of the many simple applications (like many of the tutorials will be) you do not need to break down the application into modules. In these cases your main project will be the only existing one. Now go create a new solution inside Visual studio by going through the :menuselection:`File --> New --> Project` menu selection. Choose *Win32 Console Application* as type. Enter its name and select the path where to create it. Then in the upcoming dialog make sure you create an empty project. \r
+\r
+.. image:: images/NewProjectVisualStudio.jpg\r
+   :alt: Which options to select\r
+   :align: center\r
+\r
+The *local* method\r
+==================\r
+\r
+Every project is built separately from the others. Due to this every project has its own rule package. Inside this rule packages are stored all the information the *IDE* needs to know to build your project. For any application there are at least two build modes: a *Release* and a *Debug* one. The *Debug* has many features that exist so you can find and resolve easier bugs inside your application. In contrast the *Release* is an optimized version, where the goal is to make the application run as fast as possible or to be as small as possible. You may figure that these modes also require different rules to use during build. Therefore, there exist different rule packages for each of your build modes. These rule packages are called inside the IDE as *project properties* and you can view and modify them by using the *Property Manger*. You can bring up this with :menuselection:`View --> Property Pages`. Expand it and you can see the existing rule packages (called *Proporty Sheets*). \r
+\r
+.. image:: images/PropertyPageExample.jpg\r
+   :alt: An example of Property Sheet\r
+   :align: center\r
+\r
+The really useful stuff of these is that you may create a rule package *once* and you can later just add it to your new projects. Create it once and reuse it later. We want to create a new *Property Sheet* that will contain all the rules that the compiler and linker needs to know. Of course we will need a separate one for the Debug and the Release Builds. Start up with the Debug one as shown in the image below:\r
+\r
+.. image:: images/AddNewPropertySheet.jpg\r
+   :alt: Add a new Property Sheet\r
+   :align: center\r
+\r
+Use for example the *OpenCV_Debug* name. Then by selecting the sheet :menuselection:`Right Click --> Properties`. In the following I will show to set the OpenCV rules locally, as I find unnecessary to pollute projects with custom rules that I do not use it. Go the C++ groups General entry and under the *"Additional Include Directories"* add the path to your OpenCV include. \r
+\r
+.. code-block:: bash\r
+\r
+   $(OPENCV_DIR)\include\r
+\r
+.. image:: images/PropertySheetOpenCVInclude.jpg\r
+   :alt: Add the include dir like this. \r
+   :align: center\r
+\r
+When adding third party libraries settings it is generally a good idea to use the power behind the environment variables. The full location of the OpenCV library may change on each system. Moreover, you may even end up yourself with moving the install directory for some reason. If you would give explicit paths inside your property sheet your project will end up not working when you pass it further to someone else who has a different OpenCV install path. Moreover, fixing this would require to manually modifying every explicit path. A more elegant solution is to use the environment variables. Anything that you put inside a parenthesis started with a dollar sign will be replaced at runtime with the current environment variables value. Here comes in play the environment variable setting we already made in our :ref:`previous tutorial <WindowsSetPathAndEnviromentVariable>`. \r
+\r
+Next go to the :menuselection:`Linker --> General` and under the *"Additional Library Directories"* add the libs directory:\r
+\r
+.. code-block:: bash\r
+\r
+   $(OPENCV_DIR)\libs\r
+\r
+.. image:: images/PropertySheetOpenCVLib.jpg\r
+   :alt: Add the library folder like this. \r
+   :align: center\r
+\r
+Then you need to specify the libraries in which the linker should look into. To do this go to the :menuselection:`Linker --> Input` and under the *"Additional Dependencies"* entry add the name of all modules which you want to use:\r
+\r
+.. image:: images/PropertySheetOpenCVLibrariesDebugSmple.jpg\r
+   :alt: Add the debug library names here.\r
+   :align: center\r
+\r
+.. image:: images/PropertySheetOpenCVLibrariesDebug.jpg\r
+   :alt: Like this. \r
+   :align: center\r
+\r
+The names of the libraries are as follow:\r
+\r
+.. code-block:: bash\r
+\r
+   opencv_(The Name of the module)(The version Number of the library you use)d.lib\r
+\r
+A full list, for the currently latest trunk version would contain:\r
+\r
+.. code-block:: bash\r
+\r
+   opencv_core231d.lib\r
+   opencv_imgproc231d.lib\r
+   opencv_highgui231d.lib\r
+   opencv_ml231d.lib\r
+   opencv_video231d.lib\r
+   opencv_features2d231d.lib\r
+   opencv_calib3d231d.lib\r
+   opencv_objdetect231d.lib\r
+   opencv_contrib231d.lib\r
+   opencv_legacy231d.lib\r
+   opencv_flann231d.lib\r
+\r
+The letter *d* at the end just indicates that these are the libraries required for the debug. Now click ok to save and do the same with a new property inside the Release rule section. Make sure to omit the *d* letters from the library names and to save the property sheets with the save icon above them.\r
+\r
+.. image:: images/PropertySheetOpenCVLibrariesRelease.jpg\r
+   :alt: And the release ones. \r
+   :align: center\r
+\r
+You can find your property sheets inside your projects directory. At this point it is a wise decision to back them up into some special directory, to always have them at hand in the future, whenever you create an OpenCV project. Note that for Visual Studio 2010 the file extension is *props*, while for 2008 this is *vsprops*. \r
+\r
+.. image:: images/PropertySheetInsideFolder.jpg\r
+   :alt: And the release ones. \r
+   :align: center\r
+\r
+Next time when you make a new OpenCV project just use the "Add Existing Property Sheet..." menu entry inside the Property Manager to easily add the OpenCV build rules. \r
+\r
+.. image:: images/PropertyPageAddExisting.jpg\r
+   :alt: Use this option. \r
+   :align: center\r
+\r
+The *global* method\r
+===================\r
+\r
+In case you find to troublesome to add the property pages to each and every one of your projects you can also add this rules to a *"global property page"*. However, this applies only to the additional include and library directories. The name of the libraries to use you still need to specify manually by using for instance: a Property page. \r
+\r
+In Visual Studio 2008 you can find this under the:  :menuselection:`Tools --> Options --> Projects and Solutions --> VC++ Directories`. \r
+\r
+.. image:: images/VCDirectories2008.jpg\r
+   :alt: VC++ Directories in VS 2008.\r
+   :align: center\r
+\r
+In Visual Studio 2010 this has been moved to a global property sheet which is automatically added to every project you create: \r
+\r
+.. image:: images/VCDirectories2010.jpg\r
+   :alt: VC++ Directories in VS 2010.\r
+   :align: center\r
+\r
+The process is the same as described in case of the local approach. Just add the include directories by using the environment variable *OPENCV_DIR*.\r
+\r
+Test it!\r
+========\r
+\r
+\r
+Now to try this out download our little test :download:`source code <../../../../samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/Test.cpp>` or get it from the sample code folder of the OpenCV sources. Add this to your project and build it. Here's its content:\r
+\r
+.. literalinclude:: ../../../../samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/Test.cpp\r
+   :language: cpp\r
+   :tab-width: 4\r
+   :linenos:\r
+\r
+You can start a Visual Studio build from two places. Either inside from the *IDE* (keyboard combination: :kbd:`Control-F5`) or by navigating to your build directory and start the application with a double click. The catch is that these two **aren't** the same. When you start it from the *IDE* its current working directory is the projects directory, while otherwise it is the folder where the application file currently is (so usually your build directory). Moreover, in case of starting from the *IDE* the console window will not close once finished. It will wait for a keystroke of yours.\r
+\r
+.. |voila| unicode:: voil U+00E1\r
+\r
+This is important to remember when you code inside the code open and save commands. You're resources will be saved ( and queried for at opening!!!) relatively to your working directory. This is unless you give a full, explicit path as parameter for the I/O functions. In the code above we open :download:`this OpenCV logo<../../../../samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/opencv-logo.png>`. Before starting up the application make sure you place the image file in your current working directory. Modify the image file name inside the code to try it out on other images too. Run it and |voila|: \r
+\r
+.. image:: images/SuccessVisualStudioWindows.jpg\r
+   :alt: You should have this. \r
+   :align: center\r
+\r
+\r
diff --git a/samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/Test.cpp b/samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/Test.cpp
new file mode 100644 (file)
index 0000000..6affabb
--- /dev/null
@@ -0,0 +1,24 @@
+#include <opencv2/core/core.hpp>\r
+#include <opencv2/highgui/highgui.hpp>\r
+#include <iostream>\r
+\r
+using namespace cv;\r
+\r
+int main( int argc, char** argv )\r
+{\r
+       Mat image;\r
+       image = imread("opencv-logo.png");      // Read the file\r
+\r
+       if(! image.data )                    // Check for invalid input\r
+       {\r
+               std::cout <<  "Could not open or find the image" << std::endl ;\r
+               return -1;\r
+       }\r
+\r
+       namedWindow( "Display window", CV_WINDOW_FREERATIO );// Create a window for display.\r
+       imshow( "Display window", image );                   // Show our image inside it.\r
+\r
+       waitKey(0);                                                                                      // Wait for a keystroke in the window\r
+\r
+       return 0;\r
+}
\ No newline at end of file
diff --git a/samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/opencv-logo.png b/samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/opencv-logo.png
new file mode 100644 (file)
index 0000000..8cd8155
Binary files /dev/null and b/samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/opencv-logo.png differ