我尝试使用 simpleCV,得到了一个开源代码,通过简单的修改,我能够写下一个能够检测闪烁的代码(在图像的特定位置,一个小的变化出现并消失了)。现在我想计算每分钟的闪烁次数并想绘制一个实时图表。我看到一些代码和项目使用傅里叶变换进行此类工作但无法在我的项目中实现,我终于来到这里请帮助我提前感谢:
from SimpleCV import *
cam = Camera()
threshold = 5.0 # if mean exceeds this amount do something
while True:
previous = cam.getImage() #grab a frame
time.sleep(0.5) #wait for half a second
current = cam.getImage() #grab another frame
diff = current - previous
matrix = diff.getNumpy()
mean = matrix.mean()
diff.show()
if mean >= threshold:
print "Motion Detected"