It is taking too much time to process frames while doing pixel by pixel operation of video frames
问题 import cv2 import numpy as np cap = cv2.VideoCapture(0) def threshold_slow(image): h = image.shape[0] w = image.shape[1] for x in range(0, w): for y in range(0, h): k = np.array(image[x, y]) print(k) def video(): while True: ret,frame = cap.read() frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) threshold_slow(frame) cv2.imshow('frame',frame) key = cv2.waitKey(25) if key == ord('q'): break if __name__ == '__main__': video() cap.release() cv2.destroyAllWindows() I have done almost everything I