예제 #1
0
 def test_get_binary_mask(self):
     rectangle_mask = RectangleMask((5, 4), (1, 3), (2, 4))
     mask = rectangle_mask.get_binary_mask()
     test_mask = np.array([
         [False, False, False, False],
         [False, False, True, True],
         [False, False, True, True],
         [False, False, False, False],
         [False, False, False, False],
     ])
     assert np.array_equal(mask, test_mask)
예제 #2
0
    def test_get_max_rectangle_mask(self):
        input_mask = np.array([
            [False, False, False, False],
            [False, True, True, True],
            [False, False, True, True],
            [False, False, True, False],
            [False, False, False, False],
        ])
        tested_output_mask = np.array([
            [False, False, False, False],
            [False, True, True, True],
            [False, True, True, True],
            [False, True, True, True],
            [False, False, False, False],
        ])
        rectangle_mask = get_max_rectangle_mask(input_mask)
        test_rectangle_mask = RectangleMask((5, 4), (1, 4), (1, 4))

        mask = rectangle_mask.get_binary_mask()
        test_mask = test_rectangle_mask.get_binary_mask()

        assert np.array_equal(mask, test_mask)