Ask Your Question
0

Help me begin with OpenCV project

asked 2013-08-28 06:29:59 -0500

updated 2013-08-28 06:46:53 -0500

I made an example, loading an image from disk and dísplaying it on the screen. I am using visual studio 2008 and used the code below:

image description

The following error appears:

1>c:\users\dell\documents\visual studio 2008\projects\llllllll\llllllll\llllllll.cpp(11) : error C2065: '“Example1”' : undeclared identifier
1>c:\users\dell\documents\visual studio 2008\projects\llllllll\llllllll\llllllll.cpp(12) : error C2065: '“Example1”' : undeclared identifier

I think "example1 " is the image I want to load. I placed it inside the c++ file, I tried but program is not active!

Help me please!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2013-08-28 06:49:00 -0500

Moster gravatar image

updated 2013-08-28 06:51:15 -0500

Why do you use the old deprecated c style? Try c++ which will also be supported in the future.

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, char** argv ){
   Mat image = imread( argv[1], CV_LOAD_IMAGE_COLOR);

   if(!image.data ){
      cout << "No image - no Display \n";
      return -1;
   }

   namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
   imshow( "Display Image", image );

   waitKey(0);
   return 0;
}
edit flag offensive delete link more

Comments

1

I am wondering why he doesn't have straight quotes. Probably it could get solved quite fast by using normal standard quotes.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-28 06:52:16 -0500 )edit
1

Probably he is also missing the .jpg or .png( or whatever). I dont think it will work by only having the image name

Moster gravatar imageMoster ( 2013-08-28 06:56:08 -0500 )edit
2

The way this is programmed, it you need to add the path of the image location in your VS2008 project settings to the debug options. Else please use an absolute path for the imread like c:/image.png

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-28 06:59:40 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-08-28 06:29:59 -0500

Seen: 1,406 times

Last updated: Aug 28 '13