Skip to content Skip to sidebar Skip to footer

Removing Horizontal Lines From Scanned Image

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

Solution 1:

Your ImageMagick command is erroneous and should not even work. You need to make the kernel a horizontal line not vertical and you need a longer line for the kernel. Try the following:

magick 1sa.jpg -morphology bottomhat "20x1:0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0" -negate result.png  

enter image description here

Adjust the kernel length as needed to optimize your result.

Solution 2:

Is this ImageMagick command any better in the result?

convert1sa.jpg -morphology bottomhat "20x3:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" -negate result.png  

enter image description here

Post a Comment for "Removing Horizontal Lines From Scanned Image"