Exemplo n.º 1
0
    def _captchaTest(self, image, solution):
        debordered = tools.deborder(image)
        simplified = tools.simplify(debordered)
        self.assertEqual(len(tools.getColors(simplified)), 4)

        destriped = destripe.destripe(simplified)
        destripedColors = tools.getColors(destriped)
        self.assertEqual(len(destripedColors), 2)
Exemplo n.º 2
0
    def _captchaTest(self, image, solution):
        debordered = tools.deborder(image)
        simplified = tools.simplify(debordered)
        self.assertEqual(len(tools.getColors(simplified)), 4)

        destriped = destripe.destripe(simplified)
        destripedColors = tools.getColors(destriped)
        self.assertEqual(len(destripedColors), 2)
Exemplo n.º 3
0
    def test_simple(self):
        """
        Tests the destriping algorithm on a simple image with thick borders
        and a dot in the middle. The borders are red, green, blue and yellow,
        the dot is black and the remaining area is white. The result should
        be a white picture with the dot in the middle remaining.
        """
        image, solution = samples.getSample("algorithmTests", "border.gif")
        self.assertEqual(len(tools.getColors(image)), 6)

        destriped = destripe.destripe(image)
        destripedColors = tools.getColors(destriped)
        self.assertEqual(len(destripedColors), 2)
        WHITE, BLACK = (255, 255, 255), (0, 0, 0)
        self.assertEqual(destripedColors, set([WHITE, BLACK]))

        width, height = image.size
        dotPixel = image.getpixel((width // 2, height // 2))
        self.assertEqual(dotPixel, BLACK)
Exemplo n.º 4
0
    def test_simple(self):
        """
        Tests the destriping algorithm on a simple image with thick borders
        and a dot in the middle. The borders are red, green, blue and yellow,
        the dot is black and the remaining area is white. The result should
        be a white picture with the dot in the middle remaining.
        """
        image, solution = samples.getSample("algorithmTests", "border.gif")
        self.assertEqual(len(tools.getColors(image)), 6)

        destriped = destripe.destripe(image)
        destripedColors = tools.getColors(destriped)
        self.assertEqual(len(destripedColors), 2)
        WHITE, BLACK = (255, 255, 255), (0, 0, 0)
        self.assertEqual(destripedColors, set([WHITE, BLACK]))

        width, height = image.size
        dotPixel = image.getpixel((width // 2, height // 2))
        self.assertEqual(dotPixel, BLACK)
Exemplo n.º 5
0
 def _captchaTest(self, image, solution):
     debordered = tools.deborder(image)
     destriped = destripe.destripe(debordered)
     segments = segment.segment(destriped)
     self.assertEqual(len(segments), 3)
Exemplo n.º 6
0
 def _captchaTest(self, image, solution):
     debordered = tools.deborder(image)
     simplified = tools.simplify(debordered)
     destriped = destripe.destripe(simplified)
     segments = segment.segment(destriped)
     self.assertEqual(len(segments), 3)