资源简介
几种经典的图像平滑去噪算法程序,其中包括小波软阈值和硬阈值处理。还有三个图像质量评价程序
代码片段和文件信息
function b = meanfilt2(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.22 $ $Date: 2003/01/27 20:16:04 $
[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);
idx = find(b ~= b2);
b(idx) = (double(b(idx)) + double(b2(idx)))/2;
end
%%%
%%% Function parse_inputs
%%%
function [a mn padopt] = parse_inputs(varargin)
checknargin(14narginmfilename);
% 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 sy
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1012 2006-04-22 21:52 smooth.m
文件 189 2005-05-30 10:08 zhongzhilvbo.m
文件 388 2005-04-19 10:09 xbquzao.m
文件 334 2005-06-04 18:04 wavelethardthreshold.m
文件 290 2005-06-03 16:59 NMSE.m
文件 350 2005-06-04 19:45 RMS.m
文件 465 2006-08-08 20:46 psnr.m
文件 4439 2005-06-04 19:18 meanfilt2.m
----------- --------- ---------- ----- ----
7467 8
- 上一篇:xm
l习题集选择、填空、判断和编程题 - 下一篇:纯css3 小黄人
评论
共有 条评论