我正在尝试获取第一帧并保持不变,但在每次分配给另一个变量( currImage = cv.QueryFrame(capture) )后它都会发生变化。我究竟做错了什么?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cv
cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE)
#SET CAMERA INDEX BELOW
camera_index = -1
capture = cv.CaptureFromCAM(camera_index)
isRunning = True
firstImage = cv.QueryFrame(capture)
def repeat():
global capture #declare as globals since we are assigning to them now
global camera_index
global isRunning
global firstImage
c = cv.WaitKey(100) % 0x100
currImage = cv.QueryFrame(capture)
cv.ShowImage("w1",firstImage)
if(c==27):
isRunning = False
while isRunning:
repeat()