I'm trying to change some code from openCV to openCV2 in windows using a Cmake/Mingw compiled openCV248 (on Eclipse). My normal openCV code works fine using cvLoadImage and cvShowImage. But when I try to use imread and imshow I get a Mat from the imread that has no methods and an error from eclipse that tells me that imshow has invalid arguments...
Here is an example code:
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;
int main( int argc, char** argv )
{
if( argc != 2)
{
cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image = imread("pic.jpg",0);
namedWindow( "window", CV_WINDOW_AUTOSIZE );
imshow("window", image);
waitKey(10);
resizeWindow("window", 400, 400);
waitKey(0);
return 0;
}
Any help ?