从扫描图像中删除水平线 [英] removing horizontal lines from scanned image

查看:254
本文介绍了从扫描图像中删除水平线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Imagemagick中尝试过很好的形态,但遗憾的是输出也会影响文本,因此对ocr不满意。那么有没有更快的方法从图像中删除行而不影响ocr的文本?

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?

输入图像:

Imagemagick代码:

Imagemagick code:

magick 1sa.jpg -morphology close:1 "1x4: 0,1,1,0" result.png            

输出图像

编辑:感谢所有回复的人。我终于通过以下代码使其工作:

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


推荐答案

您的ImageMagick命令是错误的,甚至不应该工作。您需要使内核成为不垂直的水平线,并且内核需要更长的线。请尝试以下方法:

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  

根据需要调整内核长度以优化结果。

Adjust the kernel length as needed to optimize your result.

这篇关于从扫描图像中删除水平线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆