#include <opencv2/opencv.hpp>
using namespace cv;
//enum {
// WINDOW_NORMAL = 0x00000000, // the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
// WINDOW_AUTOSIZE = 0x00000001, // the user cannot resize the window, the size is constrainted by the image displayed
// WINDOW_OPENGL = 0x00001000, // window with opengl support
//
// WINDOW_FULLSCREEN = 1, // change the window to fullscreen
// WINDOW_FREERATIO = 0x00000100, // the image expends as much as it can (no ratio constraint)
// WINDOW_KEEPRATIO = 0x00000000 // the ratio of the image is respected
//};
int main(int argc, char* argv[])
{
Mat srcImage = imread("1.jpg", 199);
imshow("src", srcImage);
// AUTOSIZE 用户不能靠拉动窗口调整图片大小
namedWindow("src-test1", WINDOW_AUTOSIZE);
imshow("src-test1", srcImage);
// NORMAL 用户能靠拉动窗口调整图片大小
namedWindow("src-test2", WINDOW_NORMAL);
imshow("src-test2", srcImage);
// FULLSCRENN 效果与 AUTOSIZE 几乎一致
namedWindow("src-test3", WINDOW_FULLSCREEN);
imshow("src-test3", srcImage);
// FREERATIO 效果与 NORMAL 几乎一致
namedWindow("src-test4", WINDOW_FREERATIO);
imshow("src-test4", srcImage);
// WINDOW_OPENGL 需要有OPEN_GL的库支持
//namedWindow("src-test5", WINDOW_OPENGL);
//imshow("src-test5", srcImage);
// destroyWindow 用来关闭窗口
destroyWindow("src");
// 等待任意键输入
waitKey(0);
// destroyAllWindows() 无参数,关闭所有窗口
destroyAllWindows();
return 0;
}