setWindowProperty()
The function setWindowProperty enables changing properties of a window.
@param winname Name of the window.
@param prop_id Window property to edit. The supported operation flags are: (cv::WindowPropertyFlags)
@param prop_value New value of the window property. The supported flags are: (cv::WindowFlags)
*/
CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);
第一参数:窗口名称;
第二参数:窗口属性Flag;
WindowPropertyFlags {
WND_PROP_FULLSCREEN = 0, //!< fullscreen property (can be WINDOW_NORMAL or WINDOW_FULLSCREEN).
WND_PROP_AUTOSIZE = 1, //!< autosize property (can be WINDOW_NORMAL or WINDOW_AUTOSIZE).
WND_PROP_ASPECT_RATIO = 2, //!< window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO).
WND_PROP_OPENGL = 3, //!< opengl support.
WND_PROP_VISIBLE = 4, //!< checks whether the window exists and is visible
WND_PROP_TOPMOST = 5 //!< property to toggle normal window being topmost or not
};
namedWindow()
CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
enum WindowFlags {
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.
WINDOW_GUI_EXPANDED=0x00000000, //!< status bar and tool bar
WINDOW_GUI_NORMAL = 0x00000010, //!< old fashious way
};
例子
namedWindow("【原图】", WINDOW_NORMAL);//这里需要设置成可以自由尺寸大小;
setWindowProperty("【原图】", WND_PROP_FULLSCREEN, WINDOW_FULLSCREEN);
imshow("【原图】", scrImage);