problem with imshow
include "opencv2/core/core.hpp"
include "opencv2/highgui/highgui.hpp"
include "iostream"
include "stdio.h"
include "conio.h"
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
Mat image;
image = imread("D:\ganesh.jpg", CV_LOAD_IMAGE_COLOR); // Read the file
if(! image.data ) // Check for invalid input {
cout << "Could not open or find the image" << std::endl ;
getchar();
return -1;
}
namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
imshow( "Display window", image ); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0; }
I'm using visual studio 2012 express and opencv 2.4.7.. i have tried my level best to make the above code work. i have no idea about where i'm going wrong.. image location is perfect, no problem with that.. but still it says "Could not open or find the image" every time.. please someone help me out..
the usual: try "D:/ganesh.jpg" or "D:\\ganesh.jpg"
also, you got a problem with imread, not imshow. maybe you want to change the title ?
u can add your image to location of your program and only use "ganesh.jpg" and about this you should write d:\ganesh.jpg no d:/