OpenCV installation into eclipse
General Note: I'm using Ubuntu 14.04.3 I am following the standard tutorial for installing OpenCV with eclipse cdt : http://docs.opencv.org/2.4/doc/tutori...
I installed all the libraries, exactly as directed. I checked where all of the libraries were installed in the terminal. However, eclipse tells me that it doesn't recognize the printf function.
Also in the tutorial, it says if you look in the folder, you'll find an executable. All I have that looks remotely runnable is a .o file. (I called my file test2.cpp, so this file is called test2.o) Is this the executable? Nothing in the Release folder looks like it could be run.
I actually had the same problem in another tutorial - this one by Rodrigo Berriel. http://rodrigoberriel.com/2014/10/usi... This one is different, because most of the work done is in the terminal.
With both tutorials, the results are the same. I get all the libraries installed, but for some reason, there isn't a clear executable. In the case of Berriel's tutorial, we went into the Release folder from the terminal, and the executable is supposed to be clearly marked(because it is coloured in the Linux terminal), but nothing like that was there. I've asked him why, and we are still working on it. When I do the step in the tutorial that goes into run configurations, and then presses on the c++ application tab, my Release folder comes up, instead of the file names. (test.cpp is for Berriel's tutorial, test2.cpp is for the standard one).
Specifically: C/C++ Application Machine Vision CPP Release C/C++ Container Launcher
Note that my whole project is called Machine Vision CPP. I don't think my Release folder is an executable. Even then, I don't get the Debug keyword at the end.
What should I do? Help? (note that i would really appreciate detailed instructions because i've followed 3 tutorials now, all with extremely clear and simple steps, and it still doesn't work me!)
Here is the code I'm trying to run: file: test.cpp
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv) {
Mat inputImage = imread(argv[1]);
imshow("Input Image", inputImage);
waitKey(0);
return 0;
}
file test2.cpp
#include <cv.h>
#include <highgui.h>
#include <iostream>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
Mat image;
image = imread( argv[1], 1 );
if( argc != 2 || !image.data )
{
printf("No image data \n");
cout << "No image data";
return -1;
}
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
imshow( "Display Image", image );
waitKey(0);
return 0;
}
OpenCV is not something you execute.. it is a library for you to link against and use its functionalities.
Check if you have the openCV libraries in your system:
If you installed the static library you should find files like libopencv_core.a, libopencv_imgproc.a in your system. If you installed the dynamic library, you should find libopencv_core.so, etc.
Either way, you have to link this libraries in Eclipse project properties in order to write opencv code.
Hi Pedro, I am aware that OpenCV is a library. As stated above, I did follow the tutorial, including the link on installing the OpenCV libraries. If I had not done so, then all of the object types like Mat would be giving me issues as well. I did the pkg config command on the terminal to find where my opencv libraries were stored, and they were stored under usr/lib .
Can you please tell me what is your problem, then? It might not be something in the installation, it may be something wrong with how you set your project in Eclipse.
Is it a compilation problem? What is it?
An executable is not being made in the release folder, so there is nothing for me to run. As well, eclipse doesn't recognize the printf function (or cout for that matter) even though I've included all the libraries and iostream.
whats the content of you Release folder after a successful compilation? Can you also please post the code you are trying to compile?
whats the content of your Release folder after a successful compilation? Can you also please post the code you are trying to compile?
As for the printf/cout, are you using their namespace?
Either call the function with std::cout or add "using namespace std;" in the beggining of your code
patrickhuie19@UbuntuS55:~/workspace/Machine Vision CPP/Release$ ls
Machine Vision CPP objects.mk subdir.mk test2.o test.o makefile sources.mk test2.d test.d
those are the contents of my release folder. I will the post the code I'm trying to compile in the question.
as well, once I added "using namespace std", cout no longer gave me any problems- so thanks!
however, printf still does and no executable is formed in the release folder.