def test_preprocess_image(self):
        correct_res = np.array(
            [[0, 0, 0, 0, 0], [0, 142, 85, 142, 0], [0, 85, 0, 85, 0],
             [0, 142, 85, 142, 0], [0, 0, 0, 0, 0]],
            dtype=np.uint8)

        res = preprocess_image(self.input_img,
                               self.filter_hp,
                               self.control,
                               lowpass_dim=1,
                               filter_file=None,
                               output_img=None)

        np.testing.assert_array_equal(res, correct_res)
Example #2
0
 def test_preprocess_image(self):
     correct_res = np.array([[ 0, 0, 0, 0, 0],
                             [ 0, 142, 85, 142, 0],
                             [ 0, 85, 0, 85, 0],
                             [ 0, 142, 85, 142, 0],
                             [ 0, 0, 0, 0, 0]],
                            dtype=np.uint8)
     
     res = preprocess_image(self.input_img,
                            self.filter_hp,
                            self.control,
                            lowpass_dim=1,
                            filter_file=None,
                            output_img=None)
     
     np.testing.assert_array_equal(res, correct_res)
Example #3
0
 def test_arguments(self):
     with self.assertRaises(ValueError):
         preprocess_image(self.input_img, self.filter_hp, self.control,
                          lowpass_dim=1, output_img=np.empty((5, 4), dtype=np.uint8))
     
    
     with self.assertRaises(ValueError):
         # 3d output
         preprocess_image(self.input_img, self.filter_hp, self.control,
                          lowpass_dim=1, output_img=np.empty((5, 5, 5), dtype=np.uint8))
         
     with self.assertRaises(ValueError):
         # filter_hp=2 but filter_file=None
         preprocess_image(self.input_img, 2, self.control, output_img=np.empty((5, 5), dtype=np.uint8))
    def test_arguments(self):
        with self.assertRaises(ValueError):
            preprocess_image(self.input_img,
                             self.filter_hp,
                             self.control,
                             lowpass_dim=1,
                             output_img=np.empty((5, 4), dtype=np.uint8))

        with self.assertRaises(ValueError):
            # 3d output
            preprocess_image(self.input_img,
                             self.filter_hp,
                             self.control,
                             lowpass_dim=1,
                             output_img=np.empty((5, 5, 5), dtype=np.uint8))

        with self.assertRaises(ValueError):
            # filter_hp=2 but filter_file=None
            preprocess_image(self.input_img,
                             2,
                             self.control,
                             output_img=np.empty((5, 5), dtype=np.uint8))
Example #5
0
def simple_highpass(img, cpar):
    return preprocess_image(img, 0, cpar, 25)