diff --git a/etl_captcha.py b/etl_captcha.py index c1beec7..858bd28 100644 --- a/etl_captcha.py +++ b/etl_captcha.py @@ -6,8 +6,8 @@ def remove_border(img, border_size): return img[border_size:-border_size, border_size:-border_size] -def etl_images(origin:str, destination:str): - methods = methods = [ +# def etl_images(origin:str, destination:str): +# methods = methods = [ # cv2.THRESH_BINARY, # cv2.THRESH_BINARY_INV, # cv2.THRESH_TRUNC, @@ -23,8 +23,13 @@ def etl_images(origin:str, destination:str): gray_image = cv2.cvtColor(image_without_border, cv2.COLOR_BGR2GRAY) - for j, method in enumerate(methods): - _, image_resolved = cv2.threshold(gray_image, 127, 255, method or cv2.THRESH_OTSU) + block_size = 57 + + c = 20 + +# for j, method in enumerate(methods): +# _, image_resolved = cv2.threshold(gray_image, 127, 255, method or cv2.THRESH_OTSU) + img_adaptive = cv2.adaptiveThreshold(gray_image, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, block_size, c) cv2.imwrite(f'{destination}/captcha{i}_method{j}.png', image_resolved)