def check_list(self):
items_dict = imd.ImageStorage()
items_dict = items_dict.pickled_dict
RS.press_button('equipment')
time.sleep(1)
for key in items_dict.keys():
template = items_dict[key]
#save for DEBUG
#cv2.imwrite('debug_template_file', template_)
w, h = template.shape[::-1]
pattern = RS.get_bag('only','gray')
res = cv2.matchTemplate(pattern,template,cv2.TM_CCOEFF_NORMED)
threshold = .8 #default is 8
loc = np.where( res >= threshold)
for pt in zip(*loc[::-1]):#goes through each found image
print('{} found'.format(key))
break
else:
print('{} not found'.format(key))
评论列表
文章目录