在播放视频或需要实时展示时,使用全屏的几率很大,OpenCV现在越来越强大已经支持全屏显示,而不需要在程序中再编写Windows函数,使用起来真是十分方便。
主要依靠Qt New Functions:
setWindowProperty(const string& winname, int prop_id, double prop_value)
Parameters: |
|
---|
因此调用全屏,仅仅需要,且不用重新cmake
namedWindow("FullScreen",CV_WINDOW_NORMAL);
setWindowProperty("FullScreen", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN );
测试程序:
#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace cv;
using namespace std;
int main()
{
Mat src = imread("E:/Material/Img/Heads/01.jpg",1);
imshow("src",src);
namedWindow("FullScreen",CV_WINDOW_NORMAL);
setWindowProperty("FullScreen", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN );
//需要重新编译OpenCV Support Qt
//displayOverlay("FullScreen","overlay");
//displayStatusBar("FullScreen","statusBar",10);
imshow("FullScreen",src);
waitKey();
}