Example #1
0
 def test_resize(self):
     for origsize in [(4,5), (4,4), (7,5)]:
         image = np.random.uniform(size=(4,5))
         for ny in [3,4,5,7,9,15]:
             for nx in [3,5,7,19]:
                 shape = (ny, nx)
                 x = io._resize(image, shape)
                 self.assertEqual(x.shape, shape)
             
     #- sub- and super- selection should remain centered on original image
     image = np.random.uniform(size=(4,5))
     tmp = io._resize(image, (4,3))
     self.assertTrue(np.all(tmp == image[:, 1:-1]))
     tmp = io._resize(image, (4,7))
     self.assertTrue(np.all(tmp[:,1:-1] == image))
Example #2
0
    def test_resize(self):
        for origsize in [(4, 5), (4, 4), (7, 5)]:
            image = np.random.uniform(size=(4, 5))
            for ny in [3, 4, 5, 7, 9, 15]:
                for nx in [3, 5, 7, 19]:
                    shape = (ny, nx)
                    x = io._resize(image, shape)
                    self.assertEqual(x.shape, shape)

        #- sub- and super- selection should remain centered on original image
        image = np.random.uniform(size=(4, 5))
        tmp = io._resize(image, (4, 3))
        self.assertTrue(np.all(tmp == image[:, 1:-1]))
        tmp = io._resize(image, (4, 7))
        self.assertTrue(np.all(tmp[:, 1:-1] == image))
Example #3
0
 def test_resize(self):
     image = np.random.uniform(size=(4,5))
     for shape in [(3,4), (4,5), (3,6), (5,4), (5,6)]:
         x = io._resize(image, shape)
         self.assertEqual(x.shape, shape)
Example #4
0
 def test_resize(self):
     image = np.random.uniform(size=(4, 5))
     for shape in [(3, 4), (4, 5), (3, 6), (5, 4), (5, 6)]:
         x = io._resize(image, shape)
         self.assertEqual(x.shape, shape)