what happens if i increase the kernel to 5x5 or to 7x7?is there anyway to write that in matlab code.?

3 vues (au cours des 30 derniers jours)
i am trying to do a programming for what happens when we increase a kernel to 5x5 or to 7x7. please let me know how to do the matlab programming
  7 commentaires
Sat m
Sat m le 5 Mar 2013
i do not have any code so far.... i am searching for code to increase kernel size so far....still working on that....can you help me please?
Sat m
Sat m le 5 Mar 2013
this is my code...but it is not working. i am trying to increase the kernel to 5x5 so that the image can be blurred
baseFile = 'violet.bmp';
origimage = imread('violet','bmp');
origimage = origimage(:,:,1);
figure, imagesc(origimage)
axis square
colormap gray
title('Original Image')
set(gca, 'XTick', [], 'YTick', [])
%Blur Kernel
ksize = 5;
kernel1 = zeros(ksize);
%Gaussian Blur
s = 3;
m = ksize/2;
[X, Y] = meshgrid(1:ksize);
kernel = (1/(2*pi*s^2))*exp(-((X-m).^2 + (Y-m).^2)/(2*s^2));
%Display Kernel
figure, imagesc(kernel)
axis square
title('Blur Kernel')
colormap gray
%Embeding kernel in image that is size of original image
[h, w] = size(origimage);
kernelimage = zeros(h,w);
kernelimage(1:ksize, 1:ksize) = kernel;
%Performing 2D FFTs
fftimage = fft2(double(origimage));
fftkernel = fft2(kernelimage);
%Set all zero values to minimum value
fftkernel(fftkernel == 0) = 1e-6;
%Multiply FFTs
fftblurimage = fftimage.*fftkernel;
%Perform Inverse 2D FFT
blurimage = ifft2(fftblurimage);
%Display Blurred Image
figure, imagesc(blurimage)
axis square
title('Blurred Image')
colormap gray
set(gca, 'XTick', [], 'YTick', [])

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 5 Mar 2013
For example, to create median filtered images:
filtered5x5Image = medfilt2(grayImage, [5, 5]);
filtered7x7Image = medfilt2(grayImage, [7, 7]);
Call imshow() to display the results.

Plus de réponses (0)

Catégories

En savoir plus sur Red dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by