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

3 ビュー (過去 30 日間)
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 件のコメント
Sat m
Sat m 2013 年 3 月 5 日
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 2013 年 3 月 5 日
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', [])

サインインしてコメントする。

採用された回答

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRed についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by