1 | initial version |
Here is the solution to my problem
1) I forgot to add tbb.lib abd tbb_debug.lib to Properties ->Linker ->Input->Additional Dependencies
2) Cmake does not create include/opencv2/modules.... automatically. You have to do this yourself. Since this is very boring routine and tedious I wrote a script in python to do the job. Hopefully it will be useful for others.
3) In addition I went back to the stable version 2.4.9 which has just been released. I assume it safer than 3.0.0 which is still under development and has many new additions.
To summarize
0) Assuming you have downloaded the OpenCV Source files from github and have successfully compiled the code as follows: OpenCV249 - sources (the source code from github branch 2.4.9) - build (The destination directory you built into)
If you have trouble Compiling project using Cmake take look at this Installation Guide
For some reason the include directory is lacking the necessary *.h/hpp files you need to link to. For this purpose please copy this python script.
Place the script in the directory d:\OpenCV249 and run it
1) Define as a system variable OPENCV64_DIR = d:\OpenCV249\build\ You should have in 'OpenCV249' sub-folders named 'build' and 'sources'
2) Add to path the following paths for the dlls:
%OPENCV64_DIR%\bin\Debug\;
%OPENCV64_DIR%\bin\Release\;
For compilation with TBB add this path as well:
%OPENCV64_DIR%common\tbb\bin\intel64\vc12\;
3) Open Visual Studio and create an empty console project
4) Convert the project from 32 bit to 64 bit.
-Right click on solution
-> Properties
-> Configuration Properties
-> Configuration Manager
-> Platform
-> New
-> Choose x64
-> Click on OK to save changes
5) Add in project Properties ->C++ ->Additional Include Directories, the following directories:
$(OPENCV64_DIR)\include;
If you compiled OpenCV with TBB and Eigen include these directories as well:
$(OPENCV64_DIR)\common\tbb\include;
$(OPENCV64_DIR)\common\eigen;
6) Add in project Properties ->Linker ->General ->Additional Library Directories:
$(OPENCV64_DIR)\lib\$(Configuration);
Note: $(Configuration) stands for Release or Debug according the configuration mode chosen
If you compiled OpenCV with TBB include as well:
$(OPENCV64_DIR)common/tbb/lib/intel64/vc12/;
7) Add in Properties ->Linker ->Input->Additional Dependencies, the following:
For Debug: opencv_calib3d249d.lib;opencv_contrib249d.lib;opencv_core249d.lib;opencv_features2d249d.lib;opencv_flann249d.lib;opencv_haartraining_engined.lib;opencv_highgui249d.lib;opencv_imgproc249d.lib;opencv_legacy249d.lib;opencv_ml249d.lib;opencv_nonfree249d.lib;opencv_objdetect249d.lib;;opencv_photo249d.lib;opencv_shape249d.lib;opencv_softcascade249d.lib;opencv_stitching249d.lib;opencv_superres249d.lib;opencv_ts249d.lib;opencv_video249d.lib;opencv_videostab249d.lib;
For TBB add tbb_debug.lib;tbb.lib
For Release:
opencv_calib3d249.lib;opencv_contrib249.lib;opencv_core249.lib;opencv_features2d249.lib;opencv_flann249.lib;opencv_haartraining_engine.lib;opencv_highgui249.lib;opencv_imgproc249.lib;opencv_legacy249.lib;opencv_ml249.lib;opencv_nonfree249.lib;opencv_objdetect249.lib;opencv_photo249.lib;opencv_stitching249.lib;opencv_superres249.lib;opencv_ts249.lib;opencv_video249.lib;opencv_videostab249.lib;
For TBB add tbb.lib;
Note: There is a difference between the versions 3.0.0 and 2.4.9. If you are compiling the latest source instead of the source from branch 2.4.9 you will have in addition many additional libraries for cuda.
Also in version 3.0.0 you will have the following opencv_optim300d.lib
, opencv_shape300d.lib
, opencv_softcascade300d.lib
(For release optim300.lib
, opencv_shape300.lib
, opencv_softcascade300.lib
)
P.S. Strangely for Release opencv_haartraining_engine.lib
has no numeric suffix.