None . @brief Creates a window. 创建一个窗口。 . . The..._cv2.namedwindow">
当前位置:   article > 正文

python opencv cv2.namedWindow(winname, flags=None) (命名)创建窗口 cv::WindowFlags

cv2.namedwindow
def namedWindow(winname, flags=None): # real signature unknown; restored from __doc__
    """
    namedWindow(winname[, flags]) -> None
    .   @brief Creates a window. 创建一个窗口。
    .   
    .   The function namedWindow creates a window that can be used as a placeholder for images and
    .   trackbars. Created windows are referred to by their names.
    
    · 	名为Window的函数创建一个可用作图像和轨迹栏的占位符的窗口。 创建的窗口由其名称引用。
    .   
    .   If a window with the same name already exists, the function does nothing.
    
    · 	如果已经存在具有相同名称的窗口,则该功能不执行任何操作。
    .   
    .   You can call cv::destroyWindow or cv::destroyAllWindows to close the window and de-allocate any associated
    .   memory usage. For a simple program, you do not really have to call these functions because all the
    .   resources and windows of the application are closed automatically by the operating system upon exit.
    
    ·	您可以调用cv :: destroyWindow或cv :: destroyAllWindows关闭窗口并取消分配任何关联的内存使用情况。 对于简单的程序,您实际上不必调用这些函数,因为在退出时,操作系统会自动关闭应用程序的所有资源和窗口。
    .   
    .   @note
    .   
    .   Qt backend supports additional flags Qt后端支持其他标志:
    .   -   **WINDOW_NORMAL or WINDOW_AUTOSIZE:** WINDOW_NORMAL enables you to resize the
    .   window, whereas WINDOW_AUTOSIZE adjusts automatically the window size to fit the
    .   displayed image (see imshow ), and you cannot change the window size manually.
    
    ·	WINDOW_NORMAL使您能够调整窗口大小,而WINDOW_AUTOSIZE会自动调整窗口大小以适合显示的图像(请参见imshow),并且您不能手动更改窗口大小。
    
    .   -   **WINDOW_FREERATIO or WINDOW_KEEPRATIO:** WINDOW_FREERATIO adjusts the image
    .   with no respect to its ratio, whereas WINDOW_KEEPRATIO keeps the image ratio.

	·	WINDOW_FREERATIO调整图像时不考虑其比例,而WINDOW_KEEPRATIO则保留图像比例。
	
    .   -   **WINDOW_GUI_NORMAL or WINDOW_GUI_EXPANDED:** WINDOW_GUI_NORMAL is the old way to draw the window
    .   without statusbar and toolbar, whereas WINDOW_GUI_EXPANDED is a new enhanced GUI.

	·	WINDOW_GUI_NORMAL是绘制没有状态栏和工具栏的窗口的旧方法,而WINDOW_GUI_EXPANDED是新的增强型GUI。
	
    .   By default, flags == WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | WINDOW_GUI_EXPANDED

	·	默认情况下,标志== WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | WINDOW_GUI_EXPANDED
    .   
    .   @param winname Name of the window in the window caption that may be used as a window identifier. 
    	窗口标题中可以用作窗口标识符的窗口名称。
    	
    .   @param flags Flags of the window. The supported flags are: (cv::WindowFlags)
    	窗口的标志。 支持的标志是:(cv :: WindowFlags)
    """
    pass
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50

官网:cv :: WindowFlags
在这里插入图片描述
一般不用设置flag,默认是flags == WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | WINDOW_GUI_EXPANDED,上面有写。

设置了一下:

cv2.namedWindow('{}'.format(serial_list[i]), flags=cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO | cv2.WINDOW_GUI_EXPANDED)
  • 1

表示没啥效果。。。固定不了比例
在这里插入图片描述
其他人也有相似问题:OpenCV CV_WINDOW_KEEPRATIO doesn’t work

暂未找到解决办法。。。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/618835
推荐阅读
相关标签
  

闽ICP备14008679号