def test_no_match(self): blank = np.zeros((4, 4)) template = np.array([[0, 1], [1, 0]]) expected = [] actual = convolution(template, blank) self.assertEquals(expected, actual)
def test_match(self): image = np.array([[0, 0, 0, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0]]) template = np.array([[0, 1], [1, 0]]) expected = [(0, 1)] actual = convolution(template, image) self.assertEquals(expected, actual)