Exemplo n.º 1
0
    def test_plot_canvas(self):
        image = np.ones((128, 128, 3), dtype=np.uint8)
        image_stack = np.stack([image * i for i in range(25)], axis=0)

        canvas = imageutils.batch_to_canvas(image_stack)
        fig, ax = smplt.plot_canvas(canvas, 128, 128)
        return fig
Exemplo n.º 2
0
    def test_plot_canvas(self):
        image = np.ones((128, 128, 3), dtype=np.uint8)
        image_stack = np.stack([image * i for i in range(25)], axis=0)
        from supermariopy import imageutils

        canvas = imageutils.batch_to_canvas(image_stack)
        from supermariopy import plotting

        fig, ax = plotting.plot_canvas(canvas, 128, 128)
Exemplo n.º 3
0
    def test_batch_to_canvas(self):
        from supermariopy.imageutils import batch_to_canvas

        x = np.ones((9, 100, 100, 3))
        canvas = batch_to_canvas(x)
        assert canvas.shape == (300, 300, 3)

        canvas = batch_to_canvas(x, cols=5)
        assert canvas.shape == (200, 500, 3)

        canvas = batch_to_canvas(x, cols=1)
        assert canvas.shape == (900, 100, 3)

        canvas = batch_to_canvas(x, cols=0)
        assert canvas.shape == (900, 100, 3)

        canvas = batch_to_canvas(x, cols=None)
        assert canvas.shape == (300, 300, 3)
Exemplo n.º 4
0
    def test_crop(self):
        kps = stickman.VUNetStickman.get_example_valid_keypoints_deepfashion()
        joint_img = stickman.VUNetStickman.make_joint_img(
            (128, 128),
            stickman.VUNET_JOINT_ORDER_DEEPFASHION,
            kps * 128,
        )
        joint_order = stickman.VUNET_JOINT_ORDER_DEEPFASHION

        crops = [
            stickman.VUNetStickman.normalize(joint_img, kps * 128, joint_img,
                                             joint_order, 1)
        ]
        crops = [c[0] for c in crops]
        crops = np.stack(crops, axis=0)
        crops = np.split(crops, 8, axis=-1)
        n_crops = len(crops)
        cols = math.ceil(math.sqrt(n_crops))
        crops = np.concatenate(crops, axis=0)
        crops = imageutils.batch_to_canvas(crops, cols)
        fig, ax = plt.subplots(1, 1)
        ax.imshow(crops)
        plt.savefig("test_crop.png")
        return fig