Need code to apply median filter and then gaussian filter to patches of an image

3 ビュー (過去 30 日間)
Nethra
Nethra 2013 年 11 月 21 日
回答済み: Bruno Pop-Stefanov 2013 年 11 月 21 日
The image contain some noise and then median filter and then gaussian filter to remove the noise

回答 (1 件)

Bruno Pop-Stefanov
Bruno Pop-Stefanov 2013 年 11 月 21 日
You can use medfilt2 to perform 2D median filtering on an image. Example:
% Read image
img = imread('yourimage.jpg');
% Median filtering
filtered_img = medfilt2(img);
You can use fspecial to create a Gaussian filter and use imfilter to filter the image with that filter. Example:
% Read image
img = imread('yourimage.jpg');
% Gaussian filter of size 11-by-11 and std 3 pixels
h = fspecial('gaussian', 11, 3);
% Convolve
filtered_img = imfilter(img, h);

Community Treasure Hunt

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

Start Hunting!

Translated by