black
black

Reputation: 1263

OpenCV 3.0 include tracker

I want to use a tracker, described on the OpenCV 3.0 documentation site. In OpenCV 2.x, it was necessary to recompile OpenCV including the contrib library. But as it is in the OpenCV 3 documentation, I guess that I do not have to recompile it anymore, right? But what do I have to #include in C++?

I'm trying to do this for quit a while and do not find any solution. Thank you!

EDIT Thank you! The recompiling-process worked for me without any errors. I got still several errors: He does not find 'opencv_highgui300d.dll', 'opencv_imgcodecs300d.dll'and 'opencv_core300d.dll'.

I fixed this, because I had to change the 'Path' system variable to

...\cmake-output\vc12\x86\install\x86\vc12\bin

Upvotes: 0

Views: 2182

Answers (2)

VnC
VnC

Reputation: 2026

The following link points to a very clear and nice explanation of how to install OpenCV properly and not have any problems with compilation and provided libraries.

This is the proper way to get a clean installation on Windows 7:

https://coderwall.com/p/wgaiwa/setup-opencv-with-vs2012-on-win7-64bit?p=1&q=author%3AVentsy

Hope it helps

Upvotes: 1

rhcpfan
rhcpfan

Reputation: 567

As far as I know the tracking module is still in the "contrib" module.

You have to re-compile OpenCV 3.0 using the contrib section that you may download from this github repo. When you compile OpenCV using CMake you have to specify the OPENCV_EXTRA_MODULES_PATH atribute as being the location where you have extracted the module.

If you have any issues, just let me know :)

[EDIT]

  1. Download OpenCV from here and OpenCV_Contrib module from here. Unzip them and place them in the same directory (I have put mine in D:/OPENCV-BUILD)/
  2. Open CMake and set the source code path to D:/OPENCV-BUILD/opencv-master
  3. Set the "Where to build the binaries" path to D:/OPENCV-BUILD/cmake-output/vc12/x86. Here, vc12 is the platform toolset used by VS2013 and x86 is the platform target (you may build it for x64 also)
  4. Press the configure button and select your generator (a.k.a the compiler you'd like to use). Select Visual Studio 12 2013 (for x86 build) or Visual Studio 12 2013 Win64 (for x64 build).
  5. Wait until it's done configuring. A bunch of red lines will appear, dont't worry it's all good :)
  6. Search for the following lines and uncheck them:

WITH_CUDA -> this will disable support for GPU accelerated algorithms using CUDA technology. You can build the library with CUDA support also, but it's a bit more complicated and it takes much longer. If you don't need it, un-check it :)

BUILD_DOCS, BUILD_PERF_TESTS, BUILD_TESTS. These are just some tests of the modules of the library (that I have never ever used)... Again, if you don't need them, un-check them :)

Everything related to Matlab (if you have these options). I have Matlab installed and CMake wanted to create some Matlab bindings for OpenCV. I had some issues at compiling the library with these options, so I deleted them (see the image below)

enter image description here

  1. Search for "extra" and in the OPENCV_EXTRA_MODULES_PATH set the path to your "modules" folder from the contrib module (mine is D:/OPENCV-BUILD/opencv_contrib-master/modules)

enter image description here

  1. Now click again on the "Configure" button. Wait until it says "Configuring done", and after that press on the "Generate" button. We're done with CMake!

  2. In the output folder you have selected (D:\OPENCV-BUILD\cmake-output\vc12\x86) you'll find OpenCV.sln. Open it using VS2013.

  3. In Visual Studio, select the configuration you'd like to build (I recommend you to build both for Debug and Release). Let's say you select 'Debug' first. Now right click on the solution and select "Build Solution". Wait until it's done.

  4. In the 'CMakeTargets' folder you'll find a project named INSTALL. Right click on it and select 'Project Only -> Build Only INSTALL'). This creates a new folder named install and copies the result of the build there (libs, dlls, include files, etc.).

enter image description here

  1. Repeat steps 10 and 11 for the 'Release' configuration.
  2. After these steps, you'll have the files you need in your install folder (mine is D:\OPENCV-BUILD\cmake-output\vc12\x86\install)

Upvotes: 5

Related Questions