def run(self):
while not rospy.is_shutdown():
if self.im_data:
im = self.im_data.popleft()
self.im_im.set_data(im)
self.im_fig.canvas.draw()
# Get grayscale image for converting to DVS
gray_im = cv2.cvtColor(im, cv2.COLOR_RGB2GRAY)
diff_im = gray_im.astype(np.int16) - self.prev_im
diff_im[np.where((diff_im < self.tol) & (diff_im > -self.tol))] = 0
diff_im[np.where(diff_im >= self.tol)] = 1
diff_im[np.where(diff_im <= -self.tol)] = -1
self.prev_im = np.copy(gray_im)
self.dv_im.set_data(diff_im)
self.dv_fig.canvas.draw()
评论列表
文章目录