去除莫尔纹后锐化图像

时间:2019-03-26 15:41:43

标签: image matlab image-processing

我试图通过模糊图像来去除波纹图像,然后通过增强和锐化图像使其恢复到原始质量,但是我似乎只能去除波纹并使其非常模糊,这是不是我想做的。

我尝试对图像应用滤镜以使图像模糊并删除棋盘格图案,但是如果没有棋盘格,我似乎无法将图像恢复到原始质量。

imageFiles = {'radiograph_01.jpg', 'radiograph_02.jpg'};
medWinSize = [7 11];
notchCenters{1} = [269 80; 261 123; 245 216; 238 258];
sigmas{1} = [45 20 20 45];
notchCenters{2} = [277 442; 209 450];
sigmas{2} = [20 20];
for nImage = 1:length(imageFiles)
% Load image
 [pathStr, name, ext] = fileparts(imageFiles{nImage});
 img = imread(imageFiles{nImage});
 img = im2double(img);
 [height, width] = size(img);
 figure(1); clf;
 subplot(1,3,1);
 imshow(img);

 % Median filter
 imgMed = medfilt2(img, medWinSize(nImage)*[1 1]);
 subplot(1,3,2);
 imshow(imgMed);
 imwrite(imgMed, [name '-med-filtered.jpg']);

 % Compute DFT of original image
 imgDFT = fftshift(fft2(img));
 imgDFTMag = abs(imgDFT);
 figure(2); clf;
 subplot(1,3,1);
 imshow(log(imgDFTMag), [0 10]); colorbar;

 % Apply notch filter
 [omega_x, omega_y] = meshgrid(1:width, 1:height);
 filterDFT = ones(size(omega_x));
 for n = 1:size(notchCenters{nImage},1)
 rSq = (omega_x - notchCenters{nImage}(n,1)).^2 + ...
 (omega_y - notchCenters{nImage}(n,2)).^2;
 filterDFT = filterDFT .* (1 - exp(-rSq / sigmas{nImage}(n)^2));
 end % n
 imgFiltDFT = imgDFT .* filterDFT;
 imgFiltDFTMag = abs(imgFiltDFT);
 subplot(1,3,2);
 imshow(filterDFT, [0 1]); colorbar;
 subplot(1,3,3);
 imshow(log(imgFiltDFTMag), [0 10]); colorbar;
 % Reconstruct image
 imgFilt = real(ifft2(ifftshift(imgFiltDFT)));
 imgFilt = max(0, min(1, imgFilt));
 figure(1);
 subplot(1,3,3);
 imshow(imgFilt);
 imwrite(imgFilt, [name '-notch-filtered.jpg']);
end % nImage

Original Image

使用此当前代码,将图像加载到其中,应用了滤镜并返回了没有波纹图案的图像,但效果仍然模糊。在删除此图案后,我正在尝试锐化此图像以使其恢复到原始质量。

1 个答案:

答案 0 :(得分:0)

  

但效果仍然模糊。

那是因为您使用陷波滤波器删除了高频。

  

我正在尝试对此图像进行锐化处理,以将其还原为原始图像   质量

无法将图像恢复到原始的莫尔条纹免费质量。尽管如果您更仔细地设计陷波滤波器可能会产生更好的结果。

云纹已经破坏了信息,并且随着陷波滤波器的破坏而消除了那些干扰频率。

您无法获取该信息。您唯一可以做的就是应用一些锐化滤镜,这些滤镜通常依赖于增加acutance。使用此类滤镜实际上不会使图像锐化,而是以使边缘过渡看起来更锐利的方式操纵了边缘过渡。

除了使用陷波滤波器之外,还有其他技术在很多情况下效果更好。

例如,阅读A New Method for Removing the Moire' Pattern from Images。他们使用中值过滤器。