def GetItemPixels(self, I):
'''
Locates items that should be picked up on the screen
'''
ws = [8, 14]
D1 = np.abs(I - np.array([10.8721, 12.8995, 13.9932])).sum(axis = 2) < 15
D2 = np.abs(I - np.array([118.1302, 116.0938, 106.9063])).sum(axis = 2) < 76
R1 = view_as_windows(D1, ws, ws).sum(axis = (2, 3))
R2 = view_as_windows(D2, ws, ws).sum(axis = (2, 3))
FR = ((R1 + R2 / np.prod(ws)) >= 1.0) & (R1 > 10) & (R2 > 10)
PL = np.transpose(np.nonzero(FR)) * np.array(ws)
if len(PL) <= 0:
return []
bc = Birch(threshold = 50, n_clusters = None)
bc.fit(PL)
return bc.subcluster_centers_
评论列表
文章目录