6
votes

i used a c++ programm for image processing using opencv 2.1. and that program has below include files:

#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <math.h>
#include <string.h>

but after debuging the program i get error message as:

fatal error C1083: Cannot open include file: 'opencv2/core/core.hpp': No such file or directory.

that is same as for imgproc.hpp and highgui.hpp after that i changed #include "opencv2/highgui/highgui.hpp" to #include <highgui.h> and that error solved.

But i could not find a solution for imgproc.hpp and highgui.hpp and there are no files named imgproc.hpp and highgui.hpp inside the opencv folder.

How can i solve this error?

2
If there are no files in the opencv folder, how you wanna include them?Patrick Bassut
actually i think there may be have a method to solve this. because when i changed #include "opencv2/highgui/highgui.hpp" as #include <highgui.h> one error was solvedThar1988
what IDE you're using, if any? Did you give the pkg-config --libs --cflags opencv arguments?Patrick Bassut
For me, #include <opencv/highgui.h> works fine, but I've only used OpenCV 2.3 and 2.4. I have never found the need to include the .hpp files (despite seeing it in some of the examples).juanchopanza

2 Answers

1
votes

From the path separator, I assume you are using *nix OS. So the following shell commands should help you to find the correct location of the header files:

locate highgui.h
locate highgui.hpp
-3
votes

As previously stated, your libraries aren't in an included area. Most people have tailored their responses to a Linux-based system, but if you're on Windows (i.e. Using Visual Studio), you can usually just include the entire path of your library folder in the include statement.

For example:

#include "C:\OpenCV\bin\install\opencv2\highgui\highgui.hpp"
#include "C:\OpenCV\bin\install\opencv2\imgproc\imgproc.hpp"

I recently had my fair share of errors after trying to install OpenCV 2.4.1 and finding the correct directories to include (both for 'include' and 'lib') was difficult at first. I recommend re-installing your OpenCV and going from there.

http://opencv.willowgarage.com/wiki/InstallGuide