Ejemplo n.º 1
0
    def test_resize_img_values_resize_larger(self):
        '''
        Output and input image have same shape.
        '''

        img = np.zeros([64, 128])
        img[27:37, 59:69] = 255
        img_resized = resize_img(img, 128, 256)
        img_unresized = resize_img(img_resized, 64, 128)
        diff = np.sum(img - img_unresized)
        self.assertEqual(diff, 0.0)
Ejemplo n.º 2
0
    def test_resize_img_shape_actual_aspect_lt_desired_aspect(self):
        '''
        Output shape equals desired output shape.
        '''

        img = np.uint8(np.random.uniform(0, 255, size = (64, 128)))
        img_resized = resize_img(img, 32, 80)
        self.assertCountEqual(img_resized.shape, [32, 80])