对这张硬币图像进行降噪,去除周期性噪声线

Denoise this image of a coin, removing periodic noisy lines

我有一张 360x360 的图片,我想删除其中的线条

上面的部分有周期性的噪声线我正在使用 MATLAB 我尝试了中值滤波器,但无法正常工作如何对此图像进行降噪并删除线条?

我试过了

%image 360x360
[rows, columns, numberOfColorChannels] = size(image);
subplot(2, 2, 1);
imshow(image,[]);
horizontalProfile = mean(image);
subplot(2, 2, [2, 4]);
plot(horizontalProfile, 'b-');
grid on;

bottomEnvelope = movmin(horizontalProfile, 10);
upperEnvelope = movmax(horizontalProfile, 10);
deltaGL = mean(upperEnvelope- bottomEnvelope)

hold on;
plot(bottomEnvelope, 'r-', 'LineWidth', 2);
plot(upperEnvelope, 'r-', 'LineWidth', 2);
% Compute midline
midline = (bottomEnvelope + upperEnvelope) / 2;
plot(midline, 'm-', 'LineWidth', 2);
columnsToDim = horizontalProfile > midline;
image(:, columnsToDim) = image(:, columnsToDim) - deltaGL;
subplot(2, 2, 3);
imshow(image, []);

但这并没有起到更好的作用

我已经上传图片数据到Google Drive

这是 Fast Fourier Transform (FFT) 的完美用例。

FFT 将空间域中的图像转换为其频域。通过移除相应的高频信号,频域可用于平滑空间域中的特定噪声(在您的情况下为垂直线)。有大量资源可供您了解,因此我将这部分留给您。

这是我的方法。*

import cv2
import numpy as np
import matplotlib.pyplot as plt

img = cv2.imread('coin.png',0)

# get the frequency domain
f = np.fft.fft2(img)
fshift = np.fft.fftshift(f)
magnitude_spectrum = 20*np.log(np.abs(fshift))


# smoothen the vertical lines in the spatial domain =
# remove the high frequency signals (i.e. horizontal lines) in the frequency domain 
rows, cols = img.shape
crow,ccol = rows//2 , cols//2
fshift[crow-5:crow+6, 0:ccol-10] = 0
fshift[crow-5:crow+6, ccol+11:] = 0
magnitude_spectrum_no_vertical = 20*np.log(np.abs(fshift))


# get the spatial domain back
f_ishift = np.fft.ifftshift(fshift)
img_back = np.fft.ifft2(f_ishift)
img_back = np.real(img_back)

这只是输出图像。

随意尝试不同的方法:在 FFT 之前应用高斯滤波器以改善结果、屏蔽背景等。

*: 对不起,我没有 MATLAB。不过,将我的 Python 脚本移植到 MATLAB 应该很容易。