有什么方法可以操纵显示器上显示的屏幕吗??
例如,我想模糊屏幕上显示的任何猫脸,无论是来自 youtube 还是桌面上的图像或任何地方...
我有 AI 模型可以做到这一点,但我不知道如何捕获屏幕并再次显示它,有人可以帮我解决这个问题吗?
如果有办法,我可以用 python 做吗?
我在网上搜索了一下,但是我得到的只是如何截屏并显示在窗口上,但这不是我想要的。
请附上您尝试过的内容,以便我们根据您的具体用例帮助您。
这里是一个通用的示例代码:
您可以在终端或程序运行的命令提示符中按 Ctrl + C 退出全屏模式来停止程序。
import pyautogui
from PIL import Image
# Load your AI model here
def blur_cat_faces(image):
# process the image to blur any cat faces
return processed_image
while True:
# Capture the screen
screenshot = pyautogui.screenshot()
# Convert the screenshot to a PIL image
image = Image.frombytes("RGB", screenshot.size, screenshot.tobytes())
# Process the image
processed_image = blur_cat_faces(image)
# Display the modified image in fullscreen mode
pyautogui.display(show_image=processed_image, duration=0)