31. Codes in main.cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat image1, image2;
image1 = imread("lena.bmp", CV_LOAD_IMAGE_COLOR); // Read the file
if (!image1.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
image2 = imread("lena.bmp", CV_LOAD_IMAGE_GRAYSCALE); // Read the file
if (!image2.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
cout<<"opencv test"<<endl;
namedWindow("Color Image", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Color Image", image1); // Show our image inside it.
namedWindow("Gray Scale Image", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Gray Scale Image", image2); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
destroyAllWindows();
return 0;
}