从特定窗口中显示的所有内容捕获视频流
我们可以从网络摄像头捕获视频流:
camera = cv2.VideoCapture(0)
while True:
success, frame = camera.read()
if success:
buffer = cv2.imencode('.png', frame)
Python中是否有类似的方式来捕获另一个窗口的视频流(以30 fps速率),即使此窗口不在前景中? (顶部是另一个窗口)
我想到了 Python可以获取特定窗口的屏幕截图吗?,但我怀疑它会起作用,因为被捕获的窗口不在前景中。 Techincally它被它顶部的另一个窗口隐藏了。
GDI WINAPI是否有更直接的方法?
We can capture a video stream from a webcam with:
camera = cv2.VideoCapture(0)
while True:
success, frame = camera.read()
if success:
buffer = cv2.imencode('.png', frame)
Is there a similar way in Python to capture a video stream of another window (at a 30 fps rate), even if this window is not in foreground? (Another window is on top)
I thought about methods mentioned in Can python get the screen shot of a specific window? but I doubt it will work because the window to be captured is not in foreground. Techincally it is hidden by another window on top of it.
Is there a more direct way with GDI WinApi?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管GDI可以捕获背景中的窗口,但是某些窗口无法捕获某些区域,或者您可以捕获客户端区域。如果可能,请使用屏幕捕获正如@iinspectable所建议的。
以下代码从文档示例捕获图像< /a>。
Although GDI can capture the window which in the background, some area cannot be captured for some windows Or you can just capture the client area. If possible, use Screen capture as @IInspectable suggested.
The following code is adapted from document sample Capturing an Image.