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 destripe(image): destriped = tools.filterColors(image, _borderColors(image)) cropped = destriped while len(tools.getColors(destriped)) > 2: cropped = tools.deborder(cropped) newBorderColors = _borderColors(cropped) destriped = tools.filterColors(destriped, newBorderColors) return destriped
def _captchaTest(self, image, solution): debordered = tools.deborder(image) destriped = destripe.destripe(debordered) segments = segment.segment(destriped) self.assertEqual(len(segments), 3)
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)