Opencv - Can't find header files - c++

I'm trying to start development with opencv. The problem is, until now I coul barely setup the opencv cos I cant find its header files.
I made some research regarding to this subject but none of them were realy helpful, below some of the links:
Where are the opencv2 include files?
http://answers.opencv.org/question/14712/opencvhpp-not-in-opencv2/
I made the built the files using CMAKE GUI - Built the code with MVS 11 x64 both debug and release. The compilation suceeded and I cant found libs and dlls, but no headers at all anywhere.
Checkout the pics:
Opencv2 folder
Local folder
So, now I ask, What am I missing here?
Thanks for the help
EDIT ONE:
Is that what you meant?
EDIT TWO:
I found some headers inside the source of opencv, and each of them is inside an specific folder, like core, highgui and so on - that is it? or something still wrong? cos I thought I should take the headers on the build, no on the source..

append "opencv/build/include" to your include path.
if you built the opencv libraries yourself using cmake, make sure you run the INSTALL project, and add the folder, where it installed to.
When you run make install then the include files that you need are copied to a single directory determined by the makefiles and probably displayed as a part of the output.

I know what's going on. After built the entire solution, under the "opencv" solution strcutre, there is a folder called "CMakeTargets", expand this folder, you can see "INSTALL" project, and right-click this project, then select "build" option, then after installation, all libraries and head files will be located at the correct path. Like the following picture shows:
here

Take a look at the settings that were in use when you built OpenCV - the include path must point to where the include files are for your build to have succeeded.

Related

Using ITK with xcode

I am working on an xcode project that requires me to use ITK (a c++ library), I have went through with the installation of ITK, by doing
ccmake InsightToolkit-4.13.1
and then configuring and generating the files, then runing
make
make install
but I do not know how to import the library into the xcode project, where I get the following error every time I try building it:
'itkImage.h' image file not found
I would like to know how could I import it and share it with other people on different computers.
The #include directive comes with two flavors:
With quotes (#include "file.h")
With ankle brackets (#include <file.h>)
The first usually refers to files relative to your project directory. The second is for system libraries.
You can influence the search path in the project setting:
double-click on the project in the project explorer
Click on Build settings
Click on your target
Click on All to view also hidden options
In the section Search Paths you can then update the header search path to include the absolute path of you rlibrary headers. Attention: you have to do this for the Debug and for the Release builds:
This will solve the error that you have reported.
Remark: be careful, because after this is solved, you could experience some other issues related to the good use of the library, as pointed out by drescherjm in the comments (link about registration of custom classes to the library's fatories if Cmake is not used to compile the project)

OpenCV: Code Execution Cannot Proceed, DLLs Missing

I'm making a program using OpenCV and I need feature matching. I was previously using OpenCV3 but apparently getting SURF to work is a bit of a hassle so I switched to OpenCV2.4
I downloaded the pre-built libraries and I want to use them on Visual studio but I have a problem, when I run the program I get messages like this:
When I click ok I get more follow up messages complaining about other missing dlls. I tries re-installing but still get this error.
Here are my settings:
Under C/C++>General: Additional Include Directores:
C:\opencv2.4\opencv\build\include
Under Linker>General: Additional Library Directories:
C:\opencv2.4\opencv\build\x64\vc14\lib
C:\opencv2.4\opencv\build\x64\vc14\bin
Under Linker>Incput: Additional Dependencies:
opencv_calib3d2413.lib
opencv_contrib2413.lib
opencv_core2413.lib
opencv_features2d2413.lib
opencv_flann2413.lib
opencv_gpu2413.lib
opencv_highgui2413.lib
opencv_imgproc2413.lib
opencv_legacy2413.lib
opencv_ml2413.lib
opencv_nonfree2413.lib
opencv_objdetect2413.lib
opencv_ocl2413.lib
opencv_photo2413.lib
opencv_stitching2413.lib
opencv_superres2413.lib
opencv_ts2413.lib
opencv_video2413.lib
opencv_videostab2413.lib
I've also tried editing the Environment Variables under Path I've added the include\ bin\ and lib\ directories. I have absolutely no idea how to fix this problem. I know the dlls are there.
I copied and pasted the dlls from the bin\ directory into my solution directory and everything works fine now.
I'm not sure why adding the bin\ to the path didn't work but anyway here's the solution to that problem.
The execution program did not find the DLL.
Under "Linker>General: Additional Library Directories" it expect the path for .lib files, but the DLL are searched by the program during the executio, so in the current folder and in the PATH folders.
Put the Dll's into the execution folder or modify the PATH to add the DLL's folder (in this last case remember to restart Visual Studio).
Cheers

Install OpenCV 2.4.7 in Windows 7 for any editor

I have problem with installing OpenCV under Windows 7 x64. Following this. Downloaded executable and ran it. But I do not see any bin folder, instead there are 2 folders: build and source. What to do next I do not know, what to include to system path and how?
Note:
I am not using visual c++, instead I use devcpp editor.
The OpenCV windows installer comes as a self-extraction program. It essentially packs everything including the source files, docs, and most importantly, the pre-compiled files.
The pre-compiled files are located in build, and sources files are located in source. If you are intented to use opencv libraries solely, all you need to do is to
add build/include/ into your IDE additional include list.
selectively add build/lib/.. into the additional link list according to your vs version.
add build/bin/ to your system PATH, so your program can find them.

Trying to figure out Xcode directory system

I'm a bit stuck trying to get box2D to compile and I think it's because I don't quite understand how Xcode handles its build directories.
Box2D is folder containing a set of header and source files (in various subdirectories, etc). I've added the Box2D folder to a coco touch static library project in Xcode and when I try to compile I get errors about header files not being found such as <Box2D/Common/b2BlockAllocator.h>.
I found that if I simply include the header with #include "b2BlockAllocator.h" it compiles fine and Xcode actually finds the file.
So I'm a bit stuck here, I'm assuming I need to find a way to get all includes to begin searching from the root project directory and not from the source files location but I'm not sure how I can do that in Xcode...
Any ideas?
<Box2D/Common/b2BlockAllocator.h> should be found in a directory called Box2D/Common. You said that Box2D contains a set of header and source files. Are some of these headers in a subdirectory of Box2D called Common, or are they all directly under Box2D? If it's the latter, then that's your problem.
OK I figured it out!
In the targets settings page look for 'header search paths' and add the root build directory of your project to it.

Setting Up OpenCV and .lib files

I have been trying to set up OpenCV for the past few days with no results. I am using Windows 7 and VS C++ 2008 express edition. I have downloaded and installed OpenCV 2.1 and some of the examples work. I downloaded CMake and ran it to generate the VS project files and built all of them but there with several errors, and couldn't get any farther than that.
When I ran CMake I configured it to use the VS 9 compiler, and then it brought up a list of items in red such as BUILD_EXAMPLES, BUILD_LATEX_DOCS, ect. All of them were unchecked except BUILD_NEW_PYTHON_SUPPORT, BUILD_TESTS, ENABLE_OPENMP, and OPENCV_BUILD_3RDPARTY_LIBS. I configured and generate without changing anything and then it generated the VS files such as ALL_BUILD.vcproj. I built the OpenCV VS solution in debug mode and it had 15 failures (maybe this is part of the problem or is it because I don't have python and stuff like that?)
Now there was a lib folder created after building but inside there was just this VC++ Minimum Rebuild Dependency file and Program Debug Database file, both called cvhaartraining. I believe it should have created the .lib files I need instead of this. Also, the bin folder now has a folder called Debug with the same types of files with names like cv200d and cvaux200d.
Believe I need those .lib files to move forward.
I would also greatly appreciate if someone could direct me to a reliable tutorial to set up VS for OpenCV because I have been reading a lot of tutorials and they all say different things such as some say to configure Window's environment variables and other say files are located in folders such as OpenCV/cv which I don't have. I have gotten past the point of clear headed thinking so if anyone could offer some direction or a simple list of the files I need to link then I would be thankful.
Also a side question: why when linking the OpenCV libs do you have to put them in quotes?
If you're just getting started, you should probably grab the prebuilt libraries for OpenCV instead. It's OpenCV-2.1.0-win32-vs2008.exe from this page.
Once you have that, there is really no setup. Just link to the (already built) lib files in any VS project you create, and make sure the OpenCV include directory is in the projects include path.