从图像中去除高频垂直剪切噪声
我有一些扫描图像,扫描仪似乎引入了某种我以前从未遇到过的噪音。我想找到一种自动删除它的方法。噪声看起来像高频垂直剪切。换句话说,一条看起来像 ------------
的水平线显示为 /\/\/\/\/\/\/\ /\/\
,其中剪切的幅度和频率看起来非常规则。
有人可以建议一种执行以下步骤的方法吗?
给定图像,识别剪切噪声的频率和幅度。我们可以假设它始终是垂直的,并且特征频率高于图像中自然出现的其他频率。
给定上述参数,对图像应用相反的垂直周期性剪切以消除此噪声。
了解如何使用免费图像处理包实现的工具来实现这些也会很有帮助。 (Netpbm、ImageMagick、Gimp、一些 Python 库都是一些示例。)
更新:以下是具有这种失真的图像的示例。实际上,该示例表明剪切幅度不需要在整个图像中均匀。 :-( 原始图像的分辨率更高(600 dpi)。
I have a some scanned images, where the scanner appears to have introduced a certain kind of noise that I've not encountered before. I would like to find a way to remove it automatically. The noise looks like high frequency vertical shear. In other words, a horizontal line that should look like ------------
shows up as /\/\/\/\/\/\/\/\/\
, where the amplitude and frequency of the shear seem pretty regular.
Can someone suggest a way of doing the following steps?
Given an image, identify the frequency and amplitude of the shear noise. One can assume that it is always vertical and the characteristic frequency is higher than other frequencies that naturally appear in the image.
Given the above parameters, apply an opposite, vertical, periodic shear to the image to cancel this noise.
It would also be helpful to know how these could be implemented using the tools implemented by a freely available image processing package. (Netpbm, ImageMagick, Gimp, some Python library are some examples.)
Update: Here's a sample from an image with this kind of distortion. Actually, this sample shows that the shear amplitude need not be uniform throughout the image. :-(
The original images are higher resolution (600 dpi).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决这个问题的方法是使用 FFT 将图像转换为频域。结果将是两个矩阵:图像信号幅度和图像信号相位。这两个矩阵应具有与输入图像相同的尺寸。
现在,您应该使用幅度矩阵来检测与噪声频率对应的区域中的尖峰。请注意,该矩阵该角的左上角应对应于低频分量,右下角应对应于高频。
识别出尖峰后,应将相应的系数(幅度矩阵条目)设置为零。应用逆 FFT 后,您应该获得没有噪声的输入图像。
请提供示例图像,以获得更具体(实用)的问题解决方案。
My solution to the problem would be to convert the image to frequency domain using FFT. The result will be two matrices: the image signal amplitude and the image signal phase. These two matrices should have the same dimensions of the input image.
Now, you should use the amplitude matrix to detect a spike in the area tha corresponds to the noise frequency. Note that the top left of this corner of this matrix should correspond to low frequency components and bottom right to high frequencies.
After you have indentified the spike, you should set the corresponding coefficients (amplitude matrix entries) to zero. After you apply the inverse FFT you should get the input image without the noise.
Please provide an example image for a more concrete (a practical) solution to your problem.
您可以首先使用霍夫拟合或 RANSAC 来拟合直线。为了使霍夫工作,您可能需要使用高斯模糊或形态膨胀来“涂抹”点,以便您在参数空间中的给定(rho,theta)线上获得更多命中。
一旦获得线拟合,您就可以确定原始点到每条线的相对距离。从该空间信息中,您可以使用 FFT 来帮助找到“最适合”的空间频率,然后相应地向上/向下移动像素。
作为第一次尝试,您甚至可以跳过 FFT 并使用更多的强力方法:
如果剪切沿垂直样本一致,但不一定从左到右一致,则这种技术应该有效。如果剪切始终完全垂直,那么找到水平线应该相对容易。
从您的示例图像来看,看起来好像在与名义上垂直线段的 3 向或 4 向交叉点之间的水平线段上剪切可能是一致的。您可以使用角点检测器或其他方法来查找这些交叉点,以限制像素移位操作发生的范围。
我在这里发布的技术是另一种查找暗像素水平延伸的方法,以防它们不落在一条线上:
是否有一种有效的分割算法手写文本?
除此之外,您是否有机会修复扫描仪?
You could use a Hough fit or RANSAC to fit lines first. For Hough to work you may need to "smear" the points using Gaussian blur or morphological dilation so that you get more hits for a given (rho, theta) line in parameter space.
Once you have line fits, you can determine the relative distance of the original points to each line. From that spatial information you can use FFT to find help find a "best fit" spatial frequency and then shift pixels up/down accordingly.
As a first take, you might even skip FFT and use more of a brute force method:
This sort of technique should work if the shear is consistent along a vertical sample, but not necessarily from left to right. If the shear is always exactly vertical, then finding horizontal lines should be relatively easy.
Judging from your sample image, it looks as though the shear may be consistent across a horizontal line segment between a 3-way or 4-way intersection with a nominally vertical line segment. You could use corner detectors or other methods to find these intersections to limit the extent over which a pixel shifting operation takes place.
A technique I posted here is another way to find horizontal stretches of dark pixels in case they don't fall on a line:
Is there an efficient algorithm for segmentation of handwritten text?
All that aside, is there a chance you could have the scanner fixed?