我扫描了一张带有纸张纹理图案的旧照片,我想在不降低图像质量的情况下尽可能多地去除纹理。有没有办法,可能使用 MATLAB 中的图像处理工具箱?
我尝试应用 FFT 变换(使用 Photoshop 插件),但我不能找到任何要涂掉的清晰白点。对于这种方法来说,模式可能不太规则?
您可以看到下面的示例。如果您需要完整的图像,我可以将其上传到某个地方。
I've scanned an old photo with paper texture pattern and I would like to remove the texture as much as possible without lowering the image quality. Is there a way, probably using Image Processing toolbox in MATLAB?
I've tried to apply FFT transformation (using Photoshop plugin), but I couldn't find any clear white spots to be paint over. Probably the pattern is not so regular for this method?
You can see the sample below. If you need the full image I can upload it somewhere.
发布评论
评论(4)
不幸的是,您几乎陷入了空间域,因为该模式的重复性不足以使傅立叶分析发挥作用。
正如@Jonas 和@michid 所指出的,过滤将帮助您解决这样的问题。通过过滤,您需要在要保留的细节量和要删除的噪声(或不需要的图像成分)量之间进行权衡。例如,@Jonas 使用的中值滤波器完全删除了纸张纹理(甚至是图像底部边缘附近的圆形划痕),但它也删除了眼睛、头发、脸部和背景内的所有纹理(尽管我们并没有真正删除它们)。非常关心背景,重要的是前景)。您还会看到图像对比度略有下降,这通常是不受欢迎的。这使图像具有人造的外观。
这是我处理这个问题的方法:
纸张纹理图案(阈值处理之前):
您想要作为上图中几乎没有实际的图像信息,您会发现您可以非常微弱地辨认出脸部的边缘(这不好,但这是我有时间的最好的)。纹理图像尽可能均匀(以便阈值处理在整个图像上给出相同的结果)。同样,上图的右侧稍暗,这意味着对其进行阈值处理会很困难。
最终图像:
结果并不完美,但它已完全删除了高度可见的纸张纹理图案同时比更简单的过滤方法保留更多的高频内容。
编辑
填充区域通常是纯色的,因此如果您仔细观察图像,会显得有点突出。您还可以尝试向填充区域添加一些低强度零均值高斯噪声,使它们看起来更真实。您必须选择噪声方差以匹配背景。根据经验确定它可能就足够了。
这是添加了噪声的处理后的图像:
请注意,去除纸样的部分比较困难因为添加的高斯噪声掩盖了它们。我对整个图像使用了相同的高斯分布,但如果你想更复杂,你可以对面部、背景等使用不同的分布。
Unfortunately, you're pretty much stuck in the spatial domain, as the pattern isn't really repetitive enough for Fourier analysis to be of use.
As @Jonas and @michid have pointed out, filtering will help you with a problem like this. With filtering, you face a trade-off between the amount of detail you want to keep and the amount of noise (or unwanted image components) you want to remove. For example, the median filter used by @Jonas removes the paper texture completely (even the round scratch near the bottom edge of the image) but it also removes all texture within the eyes, hair, face and background (although we don't really care about the background so much, it's the foreground that matters). You'll also see a slight decrease in image contrast, which is usually undesirable. This gives the image an artificial look.
Here's how I would handle this problem:
Paper texture pattern (before thresholding):
You want as little actual image information to be present in the above image. You'll see that you can very faintly make out the edge of the face (this isn't good, but it's the best I have time for). You also want this paper texture image to be as even as possible (so that thresholding gives equal results across the image). Again, the right hand side of the image above is slightly darker, meaning that thresholding it well will be difficult.
Final image:
The result isn't perfect, but it has completely removed the highly-visible paper texture pattern while preserving more high-frequency content than the simpler filtering approaches.
EDIT
The filled-in areas are typically plain-colored and thus stand out a bit if you look at the image very closely. You could also try adding some low-strength zero-mean Gaussian noise to the filled-in areas to make them look more realistic. You'd have to pick the noise variance to match the background. Determining it empirically may be good enough.
Here's the processed image with the noise added:
Note that the parts where the paper pattern was removed are more difficult to see because the added Gaussian noise is masking them. I used the same Gaussian distribution for the entire image but if you want to be more sophisticated you can use different distributions for the face, background, etc.
中值滤波器可以帮助您一点:
请注意,您可能需要先填充图像以避免边缘影响。
编辑:比
[15 15]
更小的过滤器内核将更好地保留图像纹理,但会留下更多可见的过滤痕迹。A median filter can help you a bit:
Note that you may want to pad the image first to avoid edge effects.
EDIT: A smaller filter kernel than
[15 15]
will preserve image texture better, but will leave more visible traces of the filtering.好吧,我尝试了一种使用各向异性扩散的不同方法,使用在更广泛区域上运行的第二个系数
这是我得到的输出:
Well i have tried out a different approach using Anisotropc diffusion using the 2nd coefficient that operates on wider areas
Here is the output i got:
从图片中可以看出,与图像本身相比,噪声的频率相对较高。因此,应用低通滤波器应该可行。查看功率谱
abs(fft(...))
以确定截止频率。From what i can See from the Picture, the Noise has a relatively high Frequency Compared to the image itself. So applying a low Pass filter should work. Have a look at the Power spectrum
abs(fft(...))
to determine the cutoff Frequency.