Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.. it says "Could not open or find the image" every time.. please someone help me out..

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..