Python OpenCV-删除标题栏,工具栏和状态栏 [英] Python OpenCV - remove title bar, toolbar, and status bar
问题描述
我已经找到了有关C ++的文档,但是关于python的文档却很少.
I've found documentation regarding C ++, but not much with python.
要在python中显示的基本代码是:
The basic code to display in python is:
import numpy as np
import cv2
# Load an color image in grayscale
img = cv2.imread('messi.jpg',0)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
显示下面的图像.但是我该怎么转呢
To show the image below. But how do I turn this
要看起来像这样吗?
我也想保持尺寸.因此,我读过一些人说要进入全屏"状态.我认为可能可行的唯一方法是全屏显示,然后调整其大小?虽然不确定这是否是一种解决方案(还试图找出如何做到这一点……我是OpenCV的新手) ).
I also want to keep the size. So I've read some people saying to go "full screen". The only way I could think that might work is do "full screen, but then resize it? Not sure if that's a solution either though (also trying to find out how to do that as well... I'm brand new to OpenCV).
推荐答案
再四处看看:
使用这些标志是如何在QT后端执行此操作.
CV_GUI_NORMAL or CV_GUI_EXPANDED: CV_GUI_NORMAL is the old way to draw the window without statusbar and toolbar, whereas CV_GUI_EXPANDED is a new enhanced GUI.
using these flags is how to do it with QT backend. CV_GUI_NORMAL or CV_GUI_EXPANDED: CV_GUI_NORMAL is the old way to draw the window without statusbar and toolbar, whereas CV_GUI_EXPANDED is a new enhanced GUI.
不幸的是,即使我非常确定我有QT后端(实际上我很肯定),cv2.namedWindow('image', flags=cv2.CV_GUI_EXPANDED)
也无法正常工作.
unfortunetly, cv2.namedWindow('image', flags=cv2.CV_GUI_EXPANDED)
does not work, even though I'm pretty sure I have QT backend (actually I'm positive I do).
在查找help(cv2)
之后,我发现了类似的标志WINDOW_GUI_EXPANDED
和WINDOW_GUI_NORMAL
.所以用那些.
After looking up help(cv2)
, I found similar flags WINDOW_GUI_EXPANDED
and WINDOW_GUI_NORMAL
. So use those.
img = cv2.imread('messi.jpg',0)
# Removes toolbar and status bar
cv2.namedWindow('image', flags=cv2.WINDOW_GUI_NORMAL)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
但是在尝试删除标题栏时仍然遇到困难.
But still having trouble trying to remove the title bar.
这篇关于Python OpenCV-删除标题栏,工具栏和状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!