Пример #1
0
    def bunny_test(self):
        bunny = ply.read_ply(test_support.resources_dir_path / "scenes" / "bunny" / "bunny.ply")

        def transform_bunny(ps):
            world_pos = [0.5, -0.2, 0.0]
            ps[:, 0] += world_pos[0]
            ps[:, [0, 1, 2]] = ps[:, [0, 2, 1]]
            ps = world_pos + (ps - world_pos) * 4
            return ps

        scene = Scene()
        scene.add_renderable(PointsCloud(transform_bunny(bunny["xyz"]).copy(), faces=bunny["face"]))
        camera = Camera(course=-120)
        projector = StripesProjector()
        viewport = (5616, 3744)
        projector_lods = 10
        self.reconstruction_case("bunny", scene, camera, projector, viewport, projector_lods)
Пример #2
0
    def bunny_test(self):
        bunny = ply.read_ply(test_support.resources_dir_path / 'scenes' /
                             'bunny' / 'bunny.ply')

        def transform_bunny(ps):
            world_pos = [0.5, -0.2, 0.0]
            ps[:, 0] += world_pos[0]
            ps[:, [0, 1, 2]] = ps[:, [0, 2, 1]]
            ps = world_pos + (ps - world_pos) * 4
            return ps

        scene = Scene()
        scene.add_renderable(
            PointsCloud(transform_bunny(bunny['xyz']).copy(),
                        faces=bunny['face']))
        camera = Camera(course=-120)
        projector = StripesProjector()
        viewport = (5616, 3744)
        projector_lods = 10
        self.reconstruction_case('bunny', scene, camera, projector, viewport,
                                 projector_lods)
Пример #3
0
    frame = Frame3D()
    datas = []
    for points_path in sys.argv[1:]:
        points = points_cloud.load_ply(points_path)
        frame.add_points_cloud(points)
    if len(sys.argv[1:]) == 0:
        dog_mesh = PointsCloud(np.array([[1, -0.5, 0], [0, -0.5, 0], [0, -0.5, 1.5], [1, -0.5, 1.5]], np.float32),
                               uv=np.float32(aabb.rect_to_quad([[0, 0], [1, 1]])),
                               faces=np.int32([[0, 1, 2], [0, 2, 3]]), name='USSR Cute Dog Poster')
        box1 = Box(xs=[0.2, 0.4], ys=[0.0, -0.4], zs=[0.6, 0.8],
                   course=-20, roll=45)
        box2 = Box(xs=[0.2, 0.5], ys=[0.0, -0.3], zs=[0.1, 0.4],
                   course=15, pitch=10)
        texture = asyncio.get_event_loop().run_until_complete(frame._gl_executor.map(gl.create_image_texture,
                                                                                     resources_dir_path / 'data' / 'dog.jpg'))
        bunny = ply.read_ply(resources_dir_path / 'scenes' / 'bunny' / 'bunny.ply')
        dog_mesh.set_texture(texture)

        def move_bunny(ps):
            world_pos = np.array([0.5, -0.2, 0.0])
            ps[:, 0] += world_pos[0]
            ps[:, [0, 1, 2]] = ps[:, [0, 2, 1]]
            ps = world_pos + (ps - world_pos) * 7
            return ps

        frame.add_points_cloud(dog_mesh)
        frame.add_points_cloud(box1)
        frame.add_points_cloud(box2)
        frame.add_points_cloud(PointsCloud(move_bunny(bunny['xyz'].copy()), faces=bunny['face']))
        projector = StripesProjector(distance=4)
        frame.scene.set_projector(projector)
Пример #4
0
                               faces=np.int32([[0, 1, 2], [0, 2, 3]]),
                               name='USSR Cute Dog Poster')
        box1 = Box(xs=[0.2, 0.4],
                   ys=[0.0, -0.4],
                   zs=[0.6, 0.8],
                   course=-20,
                   roll=45)
        box2 = Box(xs=[0.2, 0.5],
                   ys=[0.0, -0.3],
                   zs=[0.1, 0.4],
                   course=15,
                   pitch=10)
        texture = asyncio.get_event_loop().run_until_complete(
            frame._gl_executor.map(gl.create_image_texture,
                                   resources_dir_path / 'data' / 'dog.jpg'))
        bunny = ply.read_ply(resources_dir_path / 'scenes' / 'bunny' /
                             'bunny.ply')
        dog_mesh.set_texture(texture)

        def move_bunny(ps):
            world_pos = np.array([0.5, -0.2, 0.0])
            ps[:, 0] += world_pos[0]
            ps[:, [0, 1, 2]] = ps[:, [0, 2, 1]]
            ps = world_pos + (ps - world_pos) * 7
            return ps

        frame.add_points_cloud(dog_mesh)
        frame.add_points_cloud(box1)
        frame.add_points_cloud(box2)
        frame.add_points_cloud(
            PointsCloud(move_bunny(bunny['xyz'].copy()), faces=bunny['face']))
        projector = StripesProjector(distance=4)