跪求快速中值滤波算法matlab源代码 5

我正在做数字图像处理的毕设,需要用到这个程序,要能运行的,我邮箱hzau_edu@163.com,能给的分我给,O(∩_∩)O谢谢了。... 我正在做数字图像处理的毕设,需要用到这个程序,要能运行的,我邮箱 hzau_edu@163.com ,能给的分我给,O(∩_∩)O谢谢了。 展开
 我来答
yaoboxu88
2010-07-31 · TA获得超过463个赞
知道答主
回答量:194
采纳率:100%
帮助的人:165万
展开全部

你注意了,imread(路径,'name.jpg'),我是以我电脑的图片给你做的,你运行时候,MATLAB路径要改到你需要处理图片的路径。

代码如下:

I=imread('11.jpg');    %读取图像,

subplot(2,2,1),imshow(I);title('原图');  %显示原图像

J=rgb2gray(I);    %把彩色图像转化为灰度图像

subplot(2,2,2),imshow(J);title('灰度图');  %显示灰度图像

J= imnoise(J,'salt & pepper',0.005); %加上椒盐噪声

subplot(2,2,3),imshow(J);title('椒盐噪声图'); %显示加上椒盐的图像

H=medfilt2(J);   %中值滤波

subplot(2,2,4),imshow(H);title('处理后图'); %显示中值滤波后的图像

中值滤波器适合于椒盐滤波,均值滤波器适合于高斯噪声

希望能帮到你!

Sievers分析仪
2024-10-13 广告
是的。传统上,对于符合要求的内毒素检测,最终用户必须从标准内毒素库存瓶中构建至少一式两份三点标准曲线;必须有重复的阴性控制;每个样品和PPC必须一式两份。有了Sievers Eclipse内毒素检测仪,这些步骤可以通过使用预嵌入的内毒素标准... 点击进入详情页
本回答由Sievers分析仪提供
达瑟朗
2013-05-23
知道答主
回答量:4
采纳率:0%
帮助的人:6179
展开全部
function b = medfilt2(varargin)
%MEDFILT2 Perform 2-D median filtering.
% B = MEDFILT2(A,[M N]) performs median filtering of the matrix
% A in two dimensions. Each output pixel contains the median
% value in the M-by-N neighborhood around the corresponding
% pixel in the input image. MEDFILT2 pads the image with zeros
% on the edges, so the median values for the points within
% [M N]/2 of the edges may appear distorted.
%
% B = MEDFILT2(A) performs median filtering of the matrix A
% using the default 3-by-3 neighborhood.
%
% B = MEDFILT2(...,PADOPT) controls how the matrix boundaries
% are padded. PADOPT may be 'zeros' (the default),
% 'symmetric', or 'indexed'. If PADOPT is 'zeros', A is padded
% with zeros at the boundaries. If PADOPT is 'symmetric', A is
% symmetrically extended at the boundaries. If PADOPT is
% 'indexed', A is padded with ones if it is double; otherwise
% it is padded with zeros.
%
% Class Support
% -------------
% The input image A can be logical or numeric (unless the
% 'indexed' syntax is used, in which case A cannot be of class
% uint16). The output image B is of the same class as A.
%
% Remarks
% -------
% If the input image A is of integer class, all of the output
% values are returned as integers. If the number of
% pixels in the neighborhood (i.e., M*N) is even, some of the
% median values may not be integers. In these cases, the
% fractional parts are discarded. Logical input is treated
% similarly.
%
% Example
% -------
% I = imread('eight.tif');
% J = imnoise(I,'salt & pepper',0.02);
% K = medfilt2(J);
% imview(J), imview(K)
%
% See also FILTER2, ORDFILT2, WIENER2.
% Copyright 1993-2003 The MathWorks, Inc.
% $Revision: 5.18.4.6 $ $Date: 2003/08/23 05:53:02 $
[a, mn, padopt] = parse_inputs(varargin{:});
domain = ones(mn);
if (rem(prod(mn), 2) == 1)
order = (prod(mn)+1)/2;
b = ordfilt2(a, order, domain, padopt);
else
order1 = prod(mn)/2;
order2 = order1+1;
b = ordfilt2(a, order1, domain, padopt);
b2 = ordfilt2(a, order2, domain, padopt);
if islogical(b)
b = b | b2;
else
b = imlincomb(0.5, b, 0.5, b2);
end
end

%%%
%%% Function parse_inputs
%%%
function [a, mn, padopt] = parse_inputs(varargin)
checknargin(1,4,nargin,mfilename);
% There are several grandfathered syntaxes we have to catch
% and parse successfully, so we're going to use a strategy
% that's a little different that usual.
%
% First, scan the input argument list for strings. The
% string 'indexed', 'zeros', or 'symmetric' can appear basically
% anywhere after the first argument.
%
% Second, delete the strings from the argument list.
%
% The remaining argument list can be one of the following:
% MEDFILT2(A)
% MEDFILT2(A,[M N])
% MEDFILT2(A,[M N],[Mb Nb])
%
% Any syntax in which 'indexed' is followed by other arguments
% is grandfathered. Any syntax in which [Mb Nb] appears is
% grandfathered.
%
% -sle, March 1998
a = varargin{1};
charLocation = [];
for k = 2:nargin
if (ischar(varargin{k}))
charLocation = [charLocation k];
end
end
if (length(charLocation) > 1)
% More than one string in input list
eid = 'Images:medfilt2:tooManyStringInputs';
error(eid,'%s','Too many input string arguments.');
elseif isempty(charLocation)
% No string specified
padopt = 'zeros';
else
options = {'indexed', 'zeros', 'symmetric'};
padopt = checkstrs(varargin{charLocation}, options, mfilename, ...
'PADOPT', charLocation);

varargin(charLocation) = [];
end
if (strcmp(padopt, 'indexed'))
if (isa(a,'double'))
padopt = 'ones';
else
padopt = 'zeros';
end
end
if length(varargin) == 1,
mn = [3 3];% default
elseif length(varargin) >= 2,
mn = varargin{2}(:).';
if size(mn,2)~=2,
msg = 'MEDFILT2(A,[M N]): Second argument must consist of two integers.';
eid = 'Images:medfilt2:secondArgMustConsistOfTwoInts';
error(eid, msg);
elseif length(varargin) > 2,
msg = ['MEDFILT2(A,[M N],[Mb Nb],...) is an obsolete syntax. [Mb Nb]' ...
' argument is ignored.'];
wid = 'Images:medfilt2:obsoleteSyntax';
warning(wid, msg);
end
end
% The grandfathered [Mb Nb] argument, if present, is ignored.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
greatdju
2010-07-31 · TA获得超过2.2万个赞
知道大有可为答主
回答量:2486
采纳率:50%
帮助的人:4191万
展开全部
自己看medfilt2的帮助
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
barte5156
2012-07-19
知道答主
回答量:51
采纳率:0%
帮助的人:15.8万
展开全部
M = mean(A) %均值
M = median(A) %中值

查一下Matlab的Help就可以了。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 3条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式