def test_greed3(self): """Test the greedy algorithm """ main(self.INPUT_PATH, "greed", self.OUTPUT_PATH, 2) res = Image.open(self.OUTPUT_PATH) assert res.getpixel((0, 0)) == (10, 10, 10) assert res.getpixel((0, 1)) == (10, 10, 10) assert res.getpixel((1, 0)) == (252, 252, 252) assert res.getpixel((1, 1)) == (252, 252, 252)
def test_clu(self): """Test the clustering algorithm """ main(self.INPUT_PATH, "clu", self.OUTPUT_PATH, 2) res = Image.open(self.OUTPUT_PATH) assert res.getpixel((0, 0)) == (10, 10, 10) assert res.getpixel((0, 1)) == (10, 10, 10) assert res.getpixel((1, 0)) == (252, 252, 252) assert res.getpixel((1, 1)) == (252, 252, 252)
def test_grow1(self): """Test the region growth algorithm """ main(self.INPUT_PATH, "grow", self.OUTPUT_PATH, 1) res = Image.open(self.OUTPUT_PATH) assert res.getpixel((0, 0)) == (0, 0, 0) assert res.getpixel((0, 1)) == (20, 20, 20) assert res.getpixel((1, 0)) == (250, 250, 250) assert res.getpixel((1, 1)) == (255, 255, 255)
def test_grow3(self): """Test the region growth algorithm """ main(self.INPUT_PATH, "grow", self.OUTPUT_PATH, 25) res = Image.open(self.OUTPUT_PATH) assert res.getpixel((0, 0)) == (10, 10, 10) assert res.getpixel((0, 1)) == (10, 10, 10) assert res.getpixel((1, 0)) == (252, 252, 252) assert res.getpixel((1, 1)) == (252, 252, 252)
def test_pre(self): """Test the threshold algorithm """ main(self.INPUT_PATH, "pre", self.OUTPUT_PATH, 1) res = Image.open(self.OUTPUT_PATH) assert res.getpixel((0, 0)) == (0, 0, 0) assert res.getpixel((0, 1)) == (0, 0, 0) assert res.getpixel((1, 0)) == (128, 128, 128) assert res.getpixel((1, 1)) == (128, 128, 128)