def pad_test(self, filename_without_extension, new_centre):
# Load image for testing.
image = cv2.imread(os.path.join(self.path_to_test_data, 'pad_test_input.png'))
image = cv2.resize(image, (200, 200))
# Check image was loaded correctly
if image is None:
raise TypeError
# Pad Image.
modified_image = camera_utils.pad_image(image, new_centre)
# This has to be done with png.
expected_results_file = os.path.join(self.path_to_test_data, filename_without_extension + '_expected.png')
# self._overwrite_expected_results_file(expected_results_file, modified_image)
# Load expected image
expected_image = cv2.imread(expected_results_file)
# Compare images
self.assertTrue(not(np.bitwise_xor(modified_image, expected_image).any()))
评论列表
文章目录