示例#1
0
 def __call__(self, scan):
     prob = random.random()
     if prob > self.augm_prob:
         return scan
     else:
         diff = random.uniform(-self.max_height_diff, self.max_height_diff)
         points = scan.points + np.array([diff, 0, 0])
         theta = np.arcsin(scan.points[:, 2] /
                           np.linalg.norm(scan.points, axis=1))
         fov_up = np.min([
             np.max(theta) * 180 / np.pi,
             scan.proj_fov_up + self.max_angle_diff
         ])
         fov_down = np.max([
             np.min(theta) * 180 / np.pi,
             scan.proj_fov_down - self.max_angle_diff
         ])
         new_laserscan = SemLaserScan(self.color_map,
                                      project=scan.project,
                                      H=scan.proj_H,
                                      W=scan.proj_W,
                                      fov_up=fov_up,
                                      fov_down=fov_down)
         new_laserscan.set_points(points, scan.remissions)
         return new_laserscan
示例#2
0
 def __call__(self, scan):
     v_prob = random.random()
     h_prob = random.random()
     if v_prob > self.augm_prob and h_prob > self.augm_prob:
         return scan
     else:
         v_flip = True
         h_flip = True
         if v_prob > self.augm_prob:
             v_flip = False
         if h_flip > self.augm_prob:
             h_flip = False
         new_laserscan = SemLaserScan(self.color_map,
                                      project=scan.project,
                                      H=scan.proj_H,
                                      W=scan.proj_W,
                                      fov_up=scan.proj_fov_up,
                                      fov_down=scan.proj_fov_down,
                                      h_flip=h_flip,
                                      v_flip=v_flip)
         new_laserscan.set_points(scan.points, scan.remissions)
         return new_laserscan