very simple question about opencv2.3

Hello,
I am trying to read an image by using imread function as in the link (http://opencv.itseez.com/doc/tutorials/introduction/display_image/display_image.html#display-image ) but it does not work. Each time I try I get the error message "no image data". Can someone please help me about it? I just want to read an image by using imread function.My code is shown at below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
using namespace cv;

int _tmain(int argc, _TCHAR* argv[])
{
	Mat image;	
	image = imread("al.jpg");
	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;
}

Are you running the program through the debugger? If so, are you setting the working directory properly?
You use incorrect header files. You should use

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

instead of

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

See new sample on http://opencv.itseez.com/doc/tutorials/introduction/display_image/display_image.html#display-image
Topic archived. No new replies allowed.