Ask Your Question

anna.sarp's profile - activity

2018-04-06 08:52:29 -0600 received badge  Student (source)
2017-05-13 06:13:57 -0600 received badge  Famous Question (source)
2016-06-04 23:00:09 -0600 received badge  Notable Question (source)
2015-11-06 16:11:59 -0600 received badge  Popular Question (source)
2014-09-07 22:22:06 -0600 received badge  Editor (source)
2014-09-05 19:01:41 -0600 asked a question Eclipse opencv “not declared in the scope” errors at compilation

I am trying to run the following simple image display opencv program on ubuntu machine.

#include <opencv/cv.h>
#include <opencv/highgui.h>

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;
}

when I try to compile it I get errors saying imread, namedWindow, waitKey were not declared in the scope. I followed the eclipse setup instructions on OpenCV website and added include paths(usr/local/include/opencv), library path(usr/local/lib) and library files (opencv_core, opencv_highgui, etc). Any suggestions on solvingthis?