Reputation: 31
I am writing a simple program for displaying image in a window, but when running it is not loading the image. I am not getting why this is happening?
#include<opencv/cvaux.h>
#include<opencv/highgui.h>
#include<opencv/cxcore.h>
#include<opencv/cv.h>
#include<stdio.h>
#include<stdlib.h>
int main(int argc, CHAR* argv[])
{
IplImage* img = cvLoadImage("C:\Users\jai guru umesh\Desktop\6.jpg");
if (!img)
{
printf("Image can NOT Load!!!\n");
return 1;
}
cvNamedWindow("myfirstwindow");
cvShowImage("myfirstwindow", img);
cvWaitKey(0);
cvReleaseImage(&img);
return 0;
}
Upvotes: 2
Views: 6456
Reputation: 11951
\
is an escape character.
Change
IplImage* img = cvLoadImage("C:\Users\jai guru umesh\Desktop\6.jpg");
to
IplImage* img = cvLoadImage("C:\\Users\\jai guru umesh\\Desktop\\6.jpg");
or
IplImage* img = cvLoadImage("C:/Users/jai guru umesh/Desktop/6.jpg");
Upvotes: 3