OpenCv3.2+opencv_contrib extension module+VS2015+CMake3.9 solve the problem of compilation error

Recently, I want to use the SURF feature for a project, but OpenCV 3.X and above put this feature in the extension library. To use such a function (there are many others), you must use CMake to compile the source code + opencv_contrib extension library. During this process, I encountered many problems and struggled for a long time. Now I will share my successful experience with everyone :D

I think the main problem is the compilation error of the extended library opencv_contrib. The same problem that occurs when compiling the opencv3.2 source code alone can be referred to. I have no mistakes here\(^o^)/~

First start compiling the content under the official sources file successfully, note that when you run CMake for the first time, you will be prompted for language selection, because mine is VS2015 64-bit, (if it is not the first time cmake, please click CMake-GUI 3.9 menu bar Go to File -> delete cache) At this time, the value after OPENCV_EXTRA_MODULES_PATH is set to empty, the second time you need to add the extension library opencv_contrib to compile together, the sequence is as follows:



However, after OPENCV_EXTRA_MODULES_PATH sets its own path name, and then compiles with the source code sources, an error occurs, as shown below:


Error message:


The prompt is Failed to download. Of course, you may encounter various file downloads like the above or lack of error messages. Of course, we will follow the error prompts to find the reason.

Reason 1 : We can go to github or click here to download the corresponding file and replace the original location, for example, you are missing

opencv3.2 protobuf-cpp-3.1.0.tar.gz , after downloading, put this file in  D:\opencv3_2\opencv\opencv_contrib-3.2.0\modules\dnn\.download\bd5e3eed635a8d32e2b99658633815ef\v3.1.0 and replace it.

. You can also refer to this blog http://blog.csdn.net/jeanyuxia/article/details/64444635 to download what you need.  

Another important error reason 2: The language that cmake first compiles should be selected correctly (explained above), for example, I am currently VS2015 Win64, and I should pay attention to this when I first compile.

Reason 3 : The opencv version must correspond to the opencv_contrib version, otherwise the above error will occur. (mine is opencv3.2, you must download opencv_contrib 3.2.0 version), you can choose your corresponding version address here: https://github.com/opencv/opencv_contrib/releases , I chose the zip compression format , the other tag is not known yet~



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325632593&siteId=291194637