清除扫描图像中文本周围的斑点
我尝试过 -noise radius 和 -noise Geometry,但它们似乎根本没有达到我想要的效果。我有一些黑白图像(TIFF G4 传真压缩),字符周围有很多噪点。在大多数情况下,这种噪声采用 1 像素宽的像素斑点的形式。
我的愿望是执行以下 3 个步骤(按此顺序):
- 白化 1 像素宽的所有黑色像素(左侧和右侧的白色像素)
- 白化所有 1 像素高的黑色像素(上方和下方的白色像素)
- 白化所有 1 像素宽的黑色像素(左侧和右侧的白色像素)
我是否必须编写代码才能执行此操作,或者 Imagemagick 可以实现它吗?如果可以的话,你如何指定几何形状来做到这一点?
I've tried -noise radius and -noise geometry and they don't seem to do what I want at all. I have some b&w images (TIFF G4 Fax compression) with lots of noise around the characters. This noise takes the form of pixel blobs that are 1 pixel wide in most cases.
My desire is to do the following 3 steps (in this order):
- Whiteout all black pixels that are 1 pixel wide (white pixels to the left and right)
- Whiteout all black pixels that are 1 pixel tall (white pixels above and below)
- Whiteout all black pixels that are 1 pixel wide (white pixels to the left and right)
Do I have to write code to do this, or can Imagemagick pull it off? If it can, how do you specify the geometry to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于这里缺乏很多好的答案,我把这个问题放到了 ImageMagick 论坛上,他们的反应非常好。您可以在这里阅读 ImageMagick 论坛
形态学被证明是最好的答案。
Lacking a lot of good answers here, I put this one to the ImageMagick forum and their response was really good. You can read it here ImageMagick Forum
Morphology proved to be the best answer.
模糊然后锐化是散斑噪声的常规技术。
Imagemagik 可以做到这两点 - 你可能需要处理一定程度的模糊
Blur then sharpen would be the normal technique for speckle noise.
Imagemagik can do both of these - you might have to play with the amoutn of blurring