Tried this answer but there is no change.
Captcha (1.jpg)
import numpy as np
import cv2
def show_image(img, title='image'):
cv2.imshow(title, img)
cv2.waitKey(0)
cv2.destroyAllWindows()
# Load an color image in grayscale
img = cv2.imread('1.jpg', 0)
horizontal_inv = cv2.bitwise_not(img)
#perform bitwise_and to mask the lines with provided mask
masked_img = cv2.bitwise_and(img, img, mask=horizontal_inv)
#reverse the image back to normal
masked_img_inv = cv2.bitwise_not(masked_img)
kernel = np.ones((5,5),np.uint8)
dilation = cv2.dilate(masked_img_inv,kernel,iterations = 3) # to remove blackline noise
# show_image(dilation, 'dilation')
ret,thresh2 = cv2.threshold(dilation,0,5,cv2.THRESH_BINARY_INV)
thresh2=cv2.bitwise_not(thresh2)
# show_image(thresh2, 'thresh2')
cv2.imwrite('2.jpg', img)
