How to remove the pattern from microscopy scanned image

7 ビュー (過去 30 日間)
Peyman Obeidy
Peyman Obeidy 2017 年 10 月 12 日
コメント済み: Peyman Obeidy 2017 年 10 月 12 日
To remove the pattern fro the image I am using an averaging filter (see the code below). It helps with removing the background but make it hard to recover the dark points in the image(attached in '.mat' file). Any suggestion will be highly appreciated.
% code
load('Image.mat');
meanFilter = fspecial('average', [4 4]);
ImIn_filterM = imfilter(ImIn, meanFilter);
imshow(ImIn_filterM,[])
newIm=ImIn./ImIn_filterM;
imshow(newIm,[])
b = imsharpen(newIm,'Radius',2,'Amount',1);
figure, imshow(b)
I tried FFT, what didn't remove the pattern. At the end of FFT is a filtered image. I divide the original image with the filtered image to remove the background. Is this correct to do?
fontSize=10;
% Display original grayscale image.
subplot(2, 2, 1);
grayImage=ImIn;
imshow(grayImage)
title('Original Gray Scale Image', 'FontSize', fontSize)
% Perform 2D FFTs
fftOriginal = fft2(double(grayImage));
shiftedFFT = fftshift(fftOriginal);
subplot(2, 2, 2);
imshow(real(shiftedFFT));
title('Real Part of Spectrum', 'FontSize', fontSize)
subplot(2, 2, 3);
imshow(imag(shiftedFFT));
title('Imaginary Part of Spectrum', 'FontSize', fontSize)
% Display magnitude and phase of 2D FFTs
subplot(2, 2, 4);
imshow(log(abs(shiftedFFT)),[]);
colormap gray
title('Log Magnitude of Spectrum', 'FontSize', fontSize)
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Now convolve with a 2D rect function.
figure;
rectWidth = 10;
rectHeight = 5;
kernel = ones(rectHeight, rectWidth) / (rectHeight * rectWidth);
% Display it
subplot(2, 2, 1);
k = padarray(kernel, [3, 3]); % Just for display.
imshow(k, []);
axis on;
title('Kernel', 'FontSize', fontSize)
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Convolve kernel (box filter) with the image
filteredImage = conv2(double(grayImage), kernel, 'same');
% Display filtered image.
subplot(2, 2, 2);
imshow(filteredImage,[]);
title('Filtered Image', 'FontSize', fontSize)
% Perform 2D FFT on the filtered image to see its spectrum.
% We expect to see a sinc multiplication effect.
% It should look like the original but with a sinc pattern overlaid on it.
fftFiltered = fft2(double(filteredImage));
shiftedFFT = fftshift(fftFiltered);
% Display magnitude of the 2D FFT of the filtered image.
subplot(2, 2, 3);
imshow(log(abs(shiftedFFT)),[]);
colormap gray
title('Log Magnitude of Spectrum - Note sinc multiplication', 'FontSize', fontSize)
NewIm=ImIn./filteredImage;
imshow(NewIm,[]);

採用された回答

Image Analyst
Image Analyst 2017 年 10 月 12 日
Well obviously sharpening the image won't remove the stripes - if anything it will just make it worse.
Look at the log magnitude of the spectrum. See those spikes? Just erase those and inverse transform. I'm attaching a similar example that you can adapt.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by