我正在尝试使用 Python 中的 OpenCV 更改特定视频帧中的像素。我当前的代码是:
import cv2
cap = cv2.VideoCapture("plane.avi")
cap.set(1, 2) #2- the second frame of my video
res, frame = cap.read()
cv2.imshow("video", frame)
while True:
ch = 0xFF & cv2.waitKey(1)
if ch == 27:
break
Run Code Online (Sandbox Code Playgroud)
我得到了我想要的框架,但我不知道如何获取和更改它的像素。请建议一个方法。