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

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 Comments

thank you for the link, but i really need an answer of this question. it is asked in the same way in my assignment
I'm not sure what you mean by "programming for describing the effect"? How would you write a program to "describe" something? Wouldn't you just express this using a paragraph?
i am sorry for the description of question. the question was what happens when you increase the kernel size to 5x5 or to 7x7? write a program for that. can you please help me to write a program for this?
Well the result of increasing the kernel is going to depend on what type of image processing you are doing (blurring, sharpening, etc.). What is your code thus far?
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?
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', [])

Sign in to comment.

 Accepted Answer

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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!