def test_split_image(self): test_image = cv2.imread("./test_data/test_image.jpg") proc = ImageProcessor() results = proc._split_image(deepcopy(test_image), overlay=20) self.assertEqual(len(results), 3) self.assertEqual(len(results[0]), 4) self.assertEqual(results[0][1][0], 1) self.assertEqual(results[0][1][1], 0)
def test_merge_image(self): test_image = cv2.imread("./test_data/test_image.jpg") proc = ImageProcessor() results = proc._split_image(deepcopy(test_image), overlay=20) new_image = proc._recreate_image(results[0], 224, 224, results[1], results[2]) self.assertEqual(test_image[0, 0, 0], new_image[0, 0, 0]) self.assertEqual(test_image[223, 223, 2], new_image[223, 223, 2]) self.assertEqual(test_image[223, 0, 2], new_image[223, 0, 2]) self.assertEqual(test_image[0, 223, 2], new_image[0, 223, 2])