How to denoise an image
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to denoise an image and so far have done this
As a res
I = imread('noise1.png.png');
II=imread('Original.jpg');
%J=rgb2gray(I);
J=im2gray(I);
figure(1);
imhist(I);
ylim([0 1*10^4])
figure(2)
imhist(II)
ylim([0 1*10^4])
%% Median filter
average_1=fspecial('average',[3,3]);
filtered_image2=imfilter(I(250:end),average_1);
figure(5)
imhist(filtered_image2)
ylim([0 1*10^4])
%% Gaussian filter
G=imgaussfilt3(filtered_image2);%(I_filtered);
figure(4)
imhist(G)
ylim([0 1*10^4])
figure(5)
imshow(G)
%% Sharpening an image
% b=imsharpen(KK);
% figure(6)
% imhist(b)
% ylim([0 1*10^4])
% figure(7)
% imshow(b)
As a result, my processed image is (first_filter) but it is still not good and I wanted to know what I am doing wrong or how can I better improve it to come as close to the original.
0 comentarios
Respuesta aceptada
DGM
el 3 de Dic. de 2021
This isn't a median filter. It's an average filter, and it's working on some arbitrary vectorized section of the image. Applying a 2D filter to a vector isn't going to accomplish anything of use here.
average_1=fspecial('average',[3,3]);
filtered_image2=imfilter(I(250:end),average_1);
If you want to do median filtering, try doing median filtering.
noisypict = imread('noise1.png');
% Median filter
fs = 10;
medfiltpict = zeros(size(noisypict),class(noisypict));
for c = 1:size(noisypict,3)
% medfilt2() can't handle RGB
medfiltpict(:,:,c) = medfilt2(noisypict(:,:,c),[fs fs]);
end
imshow(noisypict)
imshow(medfiltpict)
2 comentarios
DGM
el 3 de Dic. de 2021
Increasing the resolution isn't going to get you anything other than a bigger blurry image. You can try to mess around with imsharpen() to recover some edge emphasis, but I doubt that's going to be much help. You can try to use weiner2() instead of medfilt2().
The image looks like it's been upscaled about 400% after the noise was added, so you'll have to bear in mind that the information it represents is commensurate with a very tiny image.
% start with a clean image instead of an upscaled screenshot
cleanpict = imread('onion.png');
noisypict = imnoise(cleanpict,'gaussian',0,0.005);
% Median filter
fs = 4;
outpict = zeros(size(noisypict),class(noisypict));
for c = 1:size(noisypict,3)
outpict(:,:,c) = medfilt2(noisypict(:,:,c),[fs fs]);
%outpict(:,:,c) = wiener2(noisypict(:,:,c),[fs fs]); % maybe mess with a weiner filter instead
end
outpict = imsharpen(outpict); % maybe mess with that
imshow(outpict)
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!