Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions etl_captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)


Expand Down