Well tried morphology in Imagemagick, but unfortunately the output also affects the text, thus making it unsatisfactory for ocr. So is there any faster way to remove the lines from image without affecting the text for ocr?
Input image:
Imagemagick code:
magick 1sa.jpg -morphology close:1 "1x4: 0,1,1,0" result.png
Output image
Edit: Thanks to all those who replied. I finally made it work by the following code:
magick E:\1sa.jpg ( +clone -threshold 50% -negate -statistic median 219x1 ) -compose lighten -composite E:\z1.jpg