Beispiel #1
0
def render_image(scene_path, out_path):
    from handsome.util import save_array_as_image

    scene = parse_scene(scene_path)
    canvas = render_scene(scene)

    buffer = array_view(canvas.downsample(1))
    buffer = np.clip(buffer, 0., 1.)
    buffer = (255. * buffer).astype(dtype=np.uint8)

    save_array_as_image(pixel_view(buffer), out_path, 'RGBA')
Beispiel #2
0
    def scene(self):
        from sweatervest import parse_scene

        attrs = self.__dict__
        scene = attrs.get('scene')

        if scene is not None:
            return scene

        scene_path = os.path.join(DATA_PATH, 'blank_scene.yaml')
        scene = parse_scene(scene_path)
        attrs['scene'] = scene

        return scene
Beispiel #3
0
def read_blank_scene():
    scene_path = os.path.join(os.path.split(__file__)[0], 'data', 'blank_scene.yaml')
    return parse_scene(scene_path)