I have tried and compile the following code with out any success, I am using Visual Studio 2010.
I get the following errors when I try to compile the code.Code:#include <cxcore.h> #include <highgui.h> #include <cv.hpp> #include <iostream> 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; }
\documents\visual studio 2010\projects\test_open_cv.cpp(6): error C2871: 'cv' : a namespace with this name does not exist
\documents\visual studio 2010\projects\test_open_cv.cpp(17): error C2065: 'Mat' : undeclared identifier
\documents\visual studio 2010\projects\test_open_cv.cpp(17): error C2146: syntax error : missing ';' before identifier 'image'
\documents\visual studio 2010\projects\test_open_cv.cpp(17): error C2065: 'image' : undeclared identifier
\documents\visual studio 2010\projects\test_open_cv.cpp(18): error C2065: 'image' : undeclared identifier
\documents\visual studio 2010\projects\test_open_cv.cpp(18): error C3861: 'imread': identifier not found
\documents\visual studio 2010\projects\test_open_cv.cpp(20): error C2065: 'image' : undeclared identifier
\documents\visual studio 2010\projects\test_open_cv.cpp(20): error C2228: left of '.data' must have class/struct/union
1> type is ''unknown-type''
\documents\visual studio 2010\projects\test_open_cv.cpp(26): error C3861: 'namedWindow': identifier not found
\documents\visual studio 2010\projects\test_open_cv.cpp(27): error C2065: 'image' : undeclared identifier
\documents\visual studio 2010\projects\test_open_cv.cpp(27): error C3861: 'imshow': identifier not found
\documents\visual studio 2010\projects\test_open_cv.cpp(29): error C3861: 'waitKey': identifier not found
I don't know why I'm getting this. Why am I getting errors for stuff already included in header files. Why am I getting the namespace not defined even though header for it is included for CV.
Thanks,
James