grey image opencv displaying image

hi... i just install opencv in vc++ 2008 using win 7
when i try to display an image the while box was grey... and i do not
know the problem.. please help

this is the code that i key in:

#include "stdafx.h"

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

int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("one.jpeg");
cvNamedWindow("Image:",1);
cvShowImage("Image:",img);

cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);

return 0;
}
Check what cvLoadImage is returning. If it returns a pointer to an image or just 0. If it returns 0 you need to check whether you are trying to load your picture from the right folder or not.
Try:

IplImage *img = cvLoadImage("one.jpeg");
If (img == 0){
You did not load the image!
}else{
show the image in "image:"
}
Topic archived. No new replies allowed.