def test_rand(self): """ Test rand. """ img = CImg((100, 100)) img.rand(-2, 2) val_min, val_max = img.min_max() self.assertGreaterEqual(val_min, -2) self.assertLessEqual(val_max, +2)
def test_normalize(self): """ Test normalize. """ img = CImg((10, 10)) img.rand(-10, 10) img.normalize(-5, 5) min_val, max_val = img.min_max() self.assertEqual(min_val, -5) self.assertEqual(max_val, 5)
def test_min_max(self): """ Test min_max. """ img = CImg(np.array([[2, -1], [0, 4]])) self.assertEqual(img.min_max(), (-1, 4))