When I Debug a sample program I got following error message ? [closed]
I'm using OpenCV2.4.2 and Visual Studio 2008
This is the error message
The program '[4060] OpenCV_sample.exe: Native' has exited with code -1 (0xffffffff).
This is the sample program
I included all the libraries which need here. using namespace cv; using namespace std;
int main( int argc, char** argv )
{
if( argc != 2)
{
cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file
if(! image.data ) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
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;
}
This is not an error. The program simply tells you it exited. The reason is clearly described in the code you pasted here - did you read the code?
Hello sammy, I'm new to these things..could u please tell me which line should I change to show the image.Or how I show the image using open CV.What's wrong with this?
Hello sammy, I'm new to these things..could u please tell me which line should I change to show the image.Or how I show the image using open CV.What's wrong with this?
Guy, I don't mean to be rude, but this is the type of things you just find for yourself. If you cannot spot the error in a second, you either are completely lazy (you do not want to read the source code by yourself), either have no idea about programming, and in that case, it's better to start with a C++ tutorial on the internet. Then, when you know the basics, go back to OpenCV. Really, there is no point trying to understand OpenCV if you do not know C++, because you'll find billions of such errors and won't be able to complete any meaningful program.