示例#1
0
    def test_crop(self):
        """
		Tests that the crop augmentation has not changed
		"""
        img = cv2.imread("test_data/augmented/org.png", 3)
        img = aug.crop(img, 1, 0, 0, 0)

        load = cv2.imread("test_data/augmented/crop.png", 3)

        np.testing.assert_array_equal(img, load)
示例#2
0
    def test_augmented_not_same_as_original(self):
        """
		Tests that the augmented images are not the same as the original
		"""
        load = cv2.imread("test_data/augmented/org.png", 3)
        org = cv2.imread("test_data/augmented/org.png", 3)

        #make sure my method of testing is valid
        img = org
        assert np.ndarray.tolist(img) == np.ndarray.tolist(load)

        img = aug.affine_transform(org)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.add_light_and_color_blur(img)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.affine_transform(org)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.brighten_darken(org, 0.6)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.brighten_darken(org, 1.4)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.blur(org)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.sharpen(org)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.rotate(org, -2)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.crop(org, 1, 0, 0, 0)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)

        img = aug.mirror(org)
        assert np.ndarray.tolist(img) != np.ndarray.tolist(load)