我在python中使用openCV制作了这个蓝色的滤镜,它可以工作,但是视频输出滞后。
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
for i in range(frame.shape[0]):
for j in range(frame.shape[1]):
frame[i][j] = [255,frame[i][j][1],frame[i][j][2]]
cv2.imshow('frame',frame)
if cv2.waitKey(1) == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
字符串
1条答案
按热度按时间csga3l581#
您可以在NumPy中使用向量化操作来避免显式循环:
字符串