OpenCV HighGui全屏在linux下 [英] OpenCV HighGui fullscreen under linux

查看:270
本文介绍了OpenCV HighGui全屏在linux下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个简单的全屏应用程序来使用Open CV显示摄像机的输出。我已经开发了大部分代码,我只是想使它全屏幕窗口适当。我已经回到最基本的基本代码如下(取自OpenCV网站):

I'm trying to make a simple fullscreen app to display the output of a camera using Open CV. I've got most of the code developed already, I'm just trying to make it fullscreen the window appropriately. I've pared back to the most basic of basic code as follows (taken from the OpenCV website):

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>

int main ( int argc, char **argv )
{
  cvNamedWindow( "My Window", 1 );
  IplImage *img = cvCreateImage( cvSize( 1920, 1200 ), IPL_DEPTH_8U, 1 );
  CvFont font;
  double hScale = 1.0;
  double vScale = 1.0;
  int lineWidth = 3;
  cvInitFont( &font, CV_FONT_HERSHEY_SIMPLEX | CV_FONT_ITALIC, hScale, vScale, 0, lineWidth );
  cvPutText( img, "Hello World!", cvPoint( 200, 400 ), &font, cvScalar( 255, 255, 0 ) );
  cvSetWindowProperty( "My Window", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN );
  cvShowImage( "My Window", img );
  cvWaitKey();
  return 0;
}

当我运行这个窗口时,窗口创建的请求的1920x1200分辨率,它不是全屏的,它只是一个正常的HighGUI窗口。我可以发誓我以前工作,但已经从垃圾和重新安装Ubuntu,并有一种感觉,我可能已经忘记了一路上的东西。

When I run this, the window gets created at the 1920x1200 resolution requested, but it's not fullscreened, it's just a normal HighGUI window. I could swear I had this working earlier, but have since trashed and re-installed Ubuntu, and have a feeling I may have forgotten something along the way.

推荐答案

更改

cvNamedWindow( "My Window", 1 );

cvNamedWindow( "My Window", CV_WINDOW_NORMAL );

检查 cvNamedWindow 的标志。

这篇关于OpenCV HighGui全屏在linux下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆