I am trying to setup opencv in eclipse Luna. I have written a sample application as follows :
#include <cv.h>
#include <highgui.h>
#include<iostream>
using namespace cv;
int main( int argc, char** argv )
{
Mat image;
image = imread( argv[1], 1 );
if( argc != 2 || !image.data )
{
printf( "No image data \n" );
return -1;
}
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
imshow( "Display Image", image );
waitKey(0);
return 0;
}
In my project properties i have included /usr/local/include/opencv in (Project->Properties->C/C++ Build->Settings->Tool Settings -> GCC C++ Compiler -> Includes -> Include Paths. )
and /usr/local/lib in (Project->Properties->C/C++ Build->Settings->Tool Settings -> GCC C++ Linker -> Libraries -> Library Search Path. )
My output of the command pkg-config --cflags opencv is -I/usr/local/include/opencv -I/usr/local/include
and the output of pkg-config --libs opencv is
-L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_viz -lopencv_adas -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_datasets -lopencv_face -lopencv_latentsvm -lopencv_objdetect -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_surface_matching -lopencv_text -lopencv_tracking -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_ml -lopencv_flann -lopencv_xobjdetect -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core -lopencv_hal
When I tried building my project i got the following errors.
‘imread’ was not declared in this scope
‘imshow’ was not declared in this scope
‘namedWindow’ was not declared in this scope
‘waitKey’ was not declared in this scope
Function 'imread' could not be resolved
Function 'imshow' could not be resolved
Function 'namedWindow' could not be resolved
Function 'waitKey' could not be resolved
Can anyone help me fixing the problem and explain what is that I was missing.