Exemplo n.º 1
0
 def render(self):
     A_to_world, world_to_A = self._change_scene()
     image_A, depth_A = self.renderer.render(self.scene, flags=self.RGBA)
     B_to_world, world_to_B = self._change_scene()
     image_B, depth_B = self.renderer.render(self.scene, flags=self.RGBA)
     image_A, alpha_A = split_alpha_channel(image_A)
     image_B, alpha_B = split_alpha_channel(image_B)
     world_to_A = scale_translation(world_to_A, self.scale)
     world_to_B = scale_translation(world_to_B, self.scale)
     A_to_world = scale_translation(A_to_world, self.scale)
     B_to_world = scale_translation(B_to_world, self.scale)
     matrices = np.vstack([
         world_to_A.flatten(),
         world_to_B.flatten(),
         A_to_world.flatten(),
         B_to_world.flatten()
     ])
     return {
         'image_A': image_A,
         'alpha_A': alpha_A,
         'depth_A': depth_A,
         'image_B': image_B,
         'alpha_B': alpha_B,
         'depth_B': depth_B,
         'matrices': matrices
     }
Exemplo n.º 2
0
def test_scale_translation_random(transform_B, distance=10.0):
    transform = scale_translation(transform_B.copy(), distance)
    assert np.allclose(transform_B[:3, -1] * distance, transform[:3, -1])