示例#1
0
 def hist_filter(self, v, t):
     t_rounded = np.around(t, 0).astype(np.int32)
     t_bins = [tools.maprange(i, (-180,180), (0,360)) for i in t_rounded]
     t_counts = np.bincount(t_bins)
     t_mode = np.argmax(t_counts)
     t_best = np.isclose(t_bins, t_mode, atol=self.DEG_TOLERANCE)
     v = v[t_best]
     t = t[t_best]
     return v, t
示例#2
0
 def hist_filter(self, v, t):
     t_rounded = np.around(t, 0).astype(np.int32)
     v_rounded = np.around(v, 1).astype(np.int32)
     t_bins = [tools.maprange(i, (-180,180), (0,360)) for i in t_rounded]
     v_bins = [i for i in v_rounded]
     t_counts = np.bincount(t_bins)
     t_mode = np.argmax(t_counts)
     best = np.isclose(t_bins, t_mode, atol=self.DEG_TOLERANCE)
     ## V_r = np.array(np.round(np.array(v[best])*10), np.uint8)
     ## T_r = np.array(np.round(t[best]), np.uint8) 
     ## output = np.zeros((200, 360, 3), np.uint8)
     ## output[:, T_r, 2] = 255
     ## output[V_r[V_r < 200], :, 1] = 255
     ## cv2.imshow('',output)
     ## if cv2.waitKey(5) == 0:
     ##     pass
     v = v[best]
     t = t[best]
     return v, t