欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > python >内容正文

python

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

发布时间:2025/3/19 python 51 豆豆
生活随笔 收集整理的这篇文章主要介绍了 python opencv cv2.namedWindow(winname, flags=None) (命名)创建窗口 cv::WindowFlags 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
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

官网: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)

表示没啥效果。。。固定不了比例

其他人也有相似问题:OpenCV CV_WINDOW_KEEPRATIO doesn’t work

暂未找到解决办法。。。

总结

以上是生活随笔为你收集整理的python opencv cv2.namedWindow(winname, flags=None) (命名)创建窗口 cv::WindowFlags的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。