如何解决检查框架列表中是否已存在该框架
我想通过网络摄像头捕获所有帧,直到重复任何帧,我都尝试过这种方法,但这给了我错误
如果frame不在frame_list中:ValueError:包含多个元素的数组的真值不明确。使用a.any()或a.all()
frame_list = [] #creating the list of frame
while(True):
ret,frame = cap.read()
if ret == True:
if frame not in frame_list:
frame_list.append(frame) #This list contain all the frames
else : break
解决方法
这对您有帮助:
present = (any((frame == frame_list).all() for x in frame_list)) #Checks if array is present in list
if present == False:
frame_list.append(frame) #This list contain all the frames
else : break
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。