Ask Your Question

Help me begin with OpenCV project

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

nghiepmechan gravatar image

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

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

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

Moster gravatar image

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

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(! ){
      cout << "No image - no Display \n";
      return -1;

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

   return 0;
edit flag offensive delete link more



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 -0600 )edit

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 -0600 )edit

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 -0600 )edit

Question Tools


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

Seen: 1,809 times

Last updated: Aug 28 '13