def execute(self, img, context): gray = utils.gray(utils.crop(img, self.NUM_RECT)) type = cv2.THRESH_BINARY | cv2.THRESH_OTSU ret, bin = cv2.threshold(gray, 60, 255, type) #cv2.imshow('tyoshi', bin) #cv2.waitKey(1) context.clear() context['tyoshi'] = utils.text(bin, "+0123456789")
def _udemae(self, img): type = cv2.THRESH_BINARY | cv2.THRESH_OTSU ret, bin = cv2.threshold(utils.gray(img), 240, 255, type) img = self._erode(bin) return utils.text(img, "SABC+-")