Я пытаюсь извлечь буквы из особенно раздражающей капчи.
Я пытаюсь сделать это с помощью opencv2, и пока это не дает мне потрясающих результатов. Возможно, я не выполнил правильные операции. Вот один из моих входов:
https://i.imgur.com/wr7xAQL.jpg
https://i.imgur.com/lUvYQph.jpg
https://i.imgur.com/VZHdkfv.jpg
https://i.imgur.com/nZCHxhh.jpg
Вот мой код:
captcha_image_out = './captcha/output/'
for filename in os.listdir(captcha_image):
if not filename.endswith(".jpg"):
continue
path = os.path.join(captcha_image, filename)
img = cv2.imread(path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.medianBlur(img, 5)
# edge detection
edges = cv2.Canny(img, 100, 200)
edges = ~edges
cv2.imwrite(os.path.join(captcha_image_out, filename), edges)
И вот мои выходы:
https://i.imgur.com/sFgPtJy.jpg
https://i.imgur.com/8TaMUiU.jpg
https://i.imgur.com/rpsjI0X.jpg
https://i.imgur.com/X88fcNs.jpg
Может ли кто-нибудь объяснить, как я могу улучшить свой код?