Where is the lib folder (or its replacement) in the current OpenCV?

前端 未结 2 1319
忘掉有多难
忘掉有多难 2021-01-24 02:52

I\'m following a book written for the older version of OpenCV (OpenCV 2 Computer Vision, by PACT) and it tells me to include the lib folder in my Visual Studio 2013 Property Man

相关标签:
2条回答
  • 2021-01-24 03:26

    As an update to Nikita's awnser: There is a cmake build bug where the x64 folder will not be created if OpenCV_RUNTIME is not set. This will happen if you build an old OpenCV (e.g. <= 3.2.0) with a newer Visual Studio Version than was available at that time (e.g. Visual Studio 2017)

    To fix this, add the correct MSVC_VERSION elseif-cases in both ./cmake/OpenCVDetectCXXCompiler.cmake and the ./cmake/templates/OpenCVConfig.root-WIN32.cmake.in (or ./cmake/OpenCVConfig.cmake in < v3.2.0) files:

    [...]
    elseif(MSVC_VERSION EQUAL 1900)
     set(OpenCV_RUNTIME vc14)
    # old version ends here with endif()
    elseif(MSVC_VERSION GREATER 1909 AND MSVC_VERSION LESS 1920)
      set(OpenCV_RUNTIME vc15)
    elseif(MSVC_VERSION GREATER 1919 AND MSVC_VERSION LESS 1930)
      set(OpenCV_RUNTIME vc16)
    endif()
    [...]
    
    0 讨论(0)
  • 2021-01-24 03:38

    The pre-built binaries will have a library folder in the corresponding path

       Local System Path(Opencv Folder)-> build->x64/x86->vc10/vc11/vc12->lib.
    

    As you mentioned that you don't wish to use it then the only option left for you is to build it locally which is a much better option if you plan to use Opencv libraries for varied functions and projects as it resolves many build errors that you might face later.

    I used the Cmake Graphical user interface to build opencv, following are the steps I followed to successfully build the libraries on my system .

    1. So, you would need to create a new folder that will contain all the Makefiles generated.
    2. Please refer to this image for clearer understanding:
    3. In GUI you define source directory path where OpenCVConfig.cmake is present, according to your image it's the current folder in your image opencv-master.
    4. Similarly, define the path to the new directory you created where all the build files would be stored.
    5. Make sure to uncheck Build_Examples to avoid configuration errors.
    6. Then click Configure at the bottom when configuring is done .(you may need to configure it twice)
    7. After click the tab adjacent to configure, Generate to create the solution file.It will ask you for the compiler name select the compiler installed on your system from the list of choices. After generation is done.
    8. Go to this path Build_New_Directory(the directory you created) you will find OpenCV.sln build this project, it will take around 10-15 minutes depending on your processor, wait patiently .If you get a build error at this point don't invest your time in debugging on Visual Studio go back to Cmake GUi and configure it again and this time give the path to dependent libraries on your system that it could not find .Repeat the process it should be successfully build now.
    9. After it is successfully build you can now locate the path of all opencv libraries build on your system as follows. Build_New_Directory(the directory you created)-> install->x64->vc10(compiler I used)->lib.
    0 讨论(0)
提交回复
热议问题