尝试建立一个使用python的在线会议情绪检测系统。我创建了一个深度学习模型来检测情绪。
使用此代码查看屏幕
import time
import cv2
import mss
import numpy
with mss.mss() as sct:
monitor = {"top": 0, "left": 0, "width": 1000, "height": 1000}
while "Screen capturing":
last_time = time.time()
img = numpy.array(sct.grab(monitor))
cv2.imshow("OpenCV/Numpy normal", img)
if cv2.waitKey(25) & 0xFF == ord("q"):
cv2.destroyAllWindows()
break有没有办法把我的模型和这个屏幕连接起来,在这个直播屏幕上看到情绪呢?
我的输出应该是面对屏幕上的情感文字。
发布于 2022-10-30 06:00:14
您可以将img变量传递给模型,并在推理过程中获取情感(作为文本)。然后,使用OpenCV putText更新图像,然后使用imshow显示更新后的映像。
img = numpy.array(sct.grab(monitor))
detected_emotion = inference(img) # model infers emotion here
image = cv2.putText(img, 'detected_emotion', org=(50, 50), font=cv2.FONT_HERSHEY_SIMPLEX, fontScale=1, color=(255, 0, 0), thickness=2, cv2.LINE_AA)
cv2.imshow("OpenCV/Numpy normal", image)https://stackoverflow.com/questions/74250700
复制相似问题