def process(frame): frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY) frame = cv2.resize(frame, (84, 84), interpolation=cv2.INTER_AREA) return frame.reshape(84, 84, 1)