I am using CMake and OpenCV with C++ and am just trying to run a simple program:
using namespace cv;
using namespace std;
Mat image = imread("test.jpg", CV_LOAD_IMAGE_UNCHANGED);
if (!image.data) //check whether the image is loaded or not
cout << "Image cannot be loaded." << endl;
cout<<"Image can be loaded."<<endl;
cout<<"Size is "<<image.size().height<<","<<image.size().width<<endl;
namedWindow( "Display window", CV_WINDOW_AUTOSIZE );
imshow( "Display Image", image );
cv::waitKey() after imshow. This is needed to proceed openCV rendering.
waitKey(0) to pause until a key is pressed or
waitKey(1) to pause as short as possible.
For further reference.