Python OpenCV - remove title bar, toolbar, and status bar

前端 未结 2 908
滥情空心
滥情空心 2021-01-19 11:52

I\'ve found documentation regarding C ++, but not much with python.

The basic code to display in python is:

import numpy as np
import cv2

# Load an          


        
2条回答
  •  梦毁少年i
    2021-01-19 12:24

    Did a little more looking around:

    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.

    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).

    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.

提交回复
热议问题