我正在使用带网络摄像头的opencv 2.我可以获得视频流并对其进行处理,但我似乎无法想出一种调整显示窗口大小的方法.我有一些水平堆叠的视频图像,但图像尺寸非常小,很难看到东西.
我的代码很简单,按照以下方式:
cv2.namedWindow("main")
....
result = np.hstack((res2, foreground))
result = np.hstack((ff, result))
cv2.imshow("main", result)
cv2.waitKey(20)
Run Code Online (Sandbox Code Playgroud)
在OpenCV的文件中指出:
namedWindow
flags – Flags of the window. Currently the only supported flag is CV_WINDOW_AUTOSIZE . If this is set, the window size is automatically adjusted to fit the displayed image (see imshow() ), and you cannot change the window size manually.
Run Code Online (Sandbox Code Playgroud)
但qt后端显然有额外的标志.我没有qt后端.有没有办法让我增加图像的大小,以便我可以看到它们?
Ale*_*xey 14
是的,遗憾的是,如果nameWindow
没有Qt后端,您无法手动调整窗口大小.你的选择:
cv2.resize
函数在显示图像之前将图像大小调整为所需大小cv2.namedWindow("main", CV_WINDOW_NORMAL)
小智 12
简单写一下
cv2.namedWindow("main", cv2.WINDOW_NORMAL)
Run Code Online (Sandbox Code Playgroud)
然后手动将其调整为所需大小
您可以WINDOW_NORMAL
在调用namedWindow
函数时使用该标志,如下所示。这将允许您调整窗口大小。
namedWindow("Image", WINDOW_NORMAL);
Run Code Online (Sandbox Code Playgroud)
检查此处namedWindow
记录的功能
归档时间: |
|
查看次数: |
36887 次 |
最近记录: |