zoukankan      html  css  js  c++  java
  • 转 [OpenCV]:Visual Studio 2012 搭建 OpenCV2.4.3

    [OpenCV under Visual Studio 2012 Ultimate]

    [Tentative experimentation for x86]

    There are really so few materials for installing the OpenCV(2.4.3) for Visual Studio 2012. Hence, I have read several blogs to do it, and fortunately I got it.

    ----------------------------------------------------------------------------------------------------------------------------

    [Envrionment]:

                      [1] OpenCV 2.4.3

                      [2] Winodws Eight

                      [3] Visual Studio 2012 Ultimate

    [Steps]:

    [1]Based on that you have installed the visual studio 2012 under windows eight.

    [2]Download the opencv2.4.3 fromhttp://opencv.org/, you may choose the windows vision.

        And it will prompt the download page automatically.

    [3]Double-Click the excutive file(.exe), which will help you unzip it, accurately not "installing".

        And now, we assume the whole directory is -->H:\MySoftware\OpenCV\opencv\

    [4]Thenceforth, you get a documentation folder named "opencv", which includes a lot of files

        for current domainant platforms ie: Winodws, Mac, Linux/Unix, iOS, Android.

        Make sure, you get the folder called "build", which is extreme significant for us.

    [5]Add the items for your "Path" system variable. Carefully I push two directories into the "Path".

           (1)H:\MySoftware\OpenCV\opencv\build\x86\vc10\bin\

           (2)H:\MySoftware\OpenCV\opencv\build\x86\vc10\lib\

          Maybe, the second one is meaningless.

          Step by step, complish it.

    [6]Restart the Visual Studio 2012, if you have runned it.

    [7]Now, we may create a new VC++ project under VS2012.

        I founded the Win32 Console Application and chose the "Empty Project".

    [8]Look up at your VS2012 File Bar, and manipulate follow under sequence:

        View -- Other Windows -- Property Manager, so you get the little "Propert Manager Window".

    [9]Concentrate the "tree", you get the one like this:

         yourSolutionName:

              @Debug|Win32

                  #Microsoft.Cpp.Win32.user

                  #Application

                  #Unicode Support

                  #Core Windows.Libraries

              @Release|Win32

                  #Microsoft.Cpp.Win32.user

                  ..... .....

    [10]Right-Click the orange one called "Microsoft.Cpp.Win32.user", and tap the "Properties" item.

    [11]Thereby, a simple window show you where you will work.

    [12]Press the "VC++ Directories" the resident on the left tree.

    [13]Focus on the right part. And click the "Include Directories" and edit it by pressing the down-arrow.

         Add the three items into it.

         (1)H:\MySoftware\OpenCV\opencv\build\include\

         (2)H:\MySoftware\OpenCV\opencv\build\include\opencv\

         (3)H:\MySoftware\OpenCV\opencv\build\include\opencv2\

        Save it after you have done.

    [14]Further more, tap the item "Library Directories" and edit it too.

          Push one directory into it :H:\MySoftware\OpenCV\opencv\build\x86\vc10\lib\

          And save it.

    [Additionally]Press the "Linker" one the left tree, and choose "Input". Concentrate the right part,

                         and edit the "Additional Directories" by adding three items:

                         (1)H:\MySoftware\OpenCV\opencv\build\x86\vc10\lib\opencv_core243d.lib

                         (2)H:\MySoftware\OpenCV\opencv\build\x86\vc10\lib\opencv_highgui243d.lib

                         (3)H:\MySoftware\OpenCV\opencv\build\x86\vc10\lib\opencv_imgproc243d.lib

                         And save it.

    [15]Now, you can "cultivate" some opencv codes in your empty project.

         [For example]:

     

            #include "highgui.h";

            int main(int argc , char** argv)
            {
                     IplImage* img= cvLoadImage("./hello.jpg");   //Be sure you have a picture in the root dir
                     cvNamedWindow("Test One", CV_WINDOW_AUTOSIZE);
                     cvShowImage("Test One",img);
                     cvWaitKey(0);
                     cvReleaseImage(&img);
                     cvDestroyWindow("Test One");
                     return 0;
             }

            //Happily, you may find the visual studio 2012 can auto-complete the part of the function

            //, which stands for the success of including the opencv header file.

             //But if you attempt to run it, vs2012 will prompt error saying "Lacking MSVCP100D.dll".

             //So Awful.

    [16]So let's solve this problem and try to think about "WHY".

         (Reason:)You may remember or not, we choose the folder which is named "vc10".

                That stands for "Visual Studio 2010" not "2012", so maybe there is something

                gone away from 2010 to 2012. To conquer it, we can find the nut called "MSVCP100D.dll"

                , get it and put it into the right place.

    [17]So "google" is a good buddy, get sufficient results of "MSVCP100D.dll" , and you can choose one

         for downloading.

    [18]Put this guy into the "Windows\System32\" folder, just it.

    [19]Run your OpenCV Project again. What was worse, a "POP" again. This time it complain about

          "NO MSVCR100D.dll". Look at it again: it is not "MSVCP100D.dll" but "MSVCR100D.dll".

    [20]So, you may have got the method: google it --> download it -->put it into Windows\System32\.

    [21]Now, come back to your cute Visual Studio 2012 andRUNyour OpenCV Project

         (Whose codes you have done) again.

    [22]HeHe, it works........................

    [23]So, you get the OpenCV now, and it is the lastest one. Enjoy it.

    ----------------------------------------------------------------------------------------------------------------------------

    [Notice]

    The method above just show the [Debug Modle]. If you desire to get the [Release One], come back to the

    [STEP NINE] and choose the GREEN ONE, and the setting for the "Linker" changing to :

         (1)H:\MySoftware\OpenCV\opencv\build\x86\vc10\lib\opencv_core243.lib

         (2)H:\MySoftware\OpenCV\opencv\build\x86\vc10\lib\opencv_highgui243.lib

         (3)H:\MySoftware\OpenCV\opencv\build\x86\vc10\lib\opencv_imgproc243.lib

    Remeber save it.

    There is no "d", becuase the character "d" stands for "DEBUG" in this area.

    ----------------------------------------------------------------------------------------------------------------------------

    [SO CUET THE OPENCV IS]

  • 相关阅读:
    微前端的那些事儿
    网络是怎样连接的 作者户根勤 交流论坛
    数据结构与算法学习
    cpu读取指令时读取的长度
    小程序开发
    npm 安装 chromedriver 失败的解决办法
    Git:代码冲突常见解决方法
    Android通过Chrome Inspect调试WebView的H5 App出现空白页面的解决方法(不需要FQ)
    pm2
    多媒体技术及应用
  • 原文地址:https://www.cnblogs.com/exlsunshine/p/3775112.html
Copyright © 2011-2022 走看看