I have a question in image processing, this code shows how to add noise to the image and then retrieve it again ... The problem when retrieving the image error occurs and show the image that was retrieved in white
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Ahmed Grera
el 2 de Sept. de 2017
Comentada: Image Analyst
el 3 de Sept. de 2017
img = imread( ('eight.tif') ); % read image, use gray-level images here.
A = imnoise(img,'Gaussian',0,1);
IMG = fft2( img ); % Fourier of img
sz = size( img );
G = fspecial('gaussian' ,[5,5]); % create a filter with std sigma same size as img
%# Filter it
h = imfilter(A,G,'same');
H = fft2( h ); % Fourier of filter
F = IMG.*H; % filter in Fourier space
f = ifft2( F ); % back to spatial domain.
figure, imagesc(f);title('Gaussian filter in Frequency Domain')
figure,imshow(img),title('Original Image');
figure,imshow(A),title('Noisy Image');
imshow(f)
% Calculate MSE, mean square error.
img =im2double(img);
f =im2double(f);
[M N] = size(img);
error0 = img - f;
Mean_Square_Error = sum(sum(error0 .* error0)) / (M * N)
0 comentarios
Respuesta aceptada
Walter Roberson
el 2 de Sept. de 2017
The result of
img = imread( ('eight.tif') ); % read image, use gray-level images here.
is almost certainly going to be one of the integer data types.
The result of
f = ifft2( F ); % back to spatial domain.
is going to be double precision.
>> min(f(:)),max(f(:))
ans =
2241610061
ans =
2319637632
... that is not even in the same range.
0 comentarios
Más respuestas (1)
Image Analyst
el 3 de Sept. de 2017
Try this, using [] to scale the image before display:
imshow(f, []);
2 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!