キーを押したときに Web カメラから画像を保存しようとしていますが、機能していません。ここに私のコードを添付します:
import cv
cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE)
camera_index = 0
capture = cv.CaptureFromCAM(camera_index)
i=0
def repeat():
global capture
global camera_index
frame = cv.QueryFrame(capture)
cv.ShowImage("w1", frame)
c = cv.WaitKey(25)
if(c=="n"):
cv.SaveImage("f"+str(i)+".jpg",frame)
i=i+1
while True:
repeat()