仅在经过一定数量的帧后才增加值
我最近写了一个程序,该程序使我正在绘制数字信号。这很简单:
def plotdigital(Af):
arraysbinary = []
blinkcheck = False
for i in Af:
if i > -15 and blinkcheck == False:
arraysbinary.append(1)
blinkcheck = True
else:
arraysbinary.append(0)
return arraysbinary
AF是我正在处理的信号,我是当前的元素。因此,每当我达到-15的值时,我都会将1附加到阵列比率。该信号是一种眼球跟踪器,有时会将一个眨眼算作两个单独的眨眼,就像彼此非常近的两个单独的眨眼:1 1 1 1 0 0 0 0 1 1 1 1 1 1 我的目标是一旦我检测到i,就不允许该程序检测另一个I> 15在检测到第一个帧后,大约20帧,从而确保每个眨眼都被视为一个,而不是两个单独的闪烁。我已经开始使用一个布尔值进行解决方案,一旦检测到I> 15,它应该切换到True,但是我似乎无法完成该程序的关闭,因此在接下来的20帧中它切换到False(I +20)。欢迎任何建议!
I recently wrote a program that makes a signal I'm plotting digital. It's pretty straight forward:
def plotdigital(Af):
arraysbinary = []
blinkcheck = False
for i in Af:
if i > -15 and blinkcheck == False:
arraysbinary.append(1)
blinkcheck = True
else:
arraysbinary.append(0)
return arraysbinary
Af is the signal I'm working on and i is the current element. So whenever i reaches the value of -15 I append 1 to the arraysbinary. The signal is an eye-tracker and it sometimes counts one blink as two separate ones very close to each other like so: 1 1 1 0 0 0 1 1 1 1
My goal is once I detect an i to not allow the program to detect another i> 15 for about 20 frames after it's detected the first one, thus ensuring that each blink is counted as one and not as two separate ones. I've started working on a solution with a boolean that is supposed to switch to True once an i>15 has been detected, but I can't seem to finish the program off so it switches to False for the next 20 frames (i+20). Any suggestions are welcome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将索引值放入最小连续帧阈值的 if 条件中。见下文:
注意:我使用了与您不同的比较值,请根据您的用例进行更改。
You should put the index value in if condition for your min consecutive frame threshold. See below:
Note: I have used a different comparison value than yours, please change it as per your use case.