How to remove the pattern from microscopy scanned image
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Peyman Obeidy
el 12 de Oct. de 2017
Comentada: Peyman Obeidy
el 12 de Oct. de 2017
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,[]);
0 comentarios
Respuesta aceptada
Image Analyst
el 12 de Oct. de 2017
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!