def _simpleDestripe(image, condition=_segmentCondition): destriped = cropped = tools.simplify(image, 8) while not condition(destriped): newBorderColors = _borderColors(cropped) destriped = tools.filterColors(destriped, newBorderColors) cropped = tools.deborder(cropped) return destriped
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)
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)