mupq.m

来自「用matlab实现图像融合」· M 代码 · 共 40 行

M
40
字号
function val = mupq(F, p, q, Center)%------------------------------------------------------------------------------%% This function computes the central moments mu_{pq} of the gridfunction F% (seen as a density distribution).%% F      = input gridfunction (discrete density distribution).%% p, q   = input, order of the central moment (p in x-dir, q in y-dir).%% Center = input (optional argument), center of mass%% Note: calls mupq(F,1,0) and mupq(F,0,1) should result into zero (apart from%       rounding error).%% See also m00, m01, m10%% Design and implementation by:% Dr. Paul M. de Zeeuw <Paul.de.Zeeuw@cwi.nl>  http://homepages.cwi.nl/~pauldz/% Last Revision: November 27, 2000.% Copyright 2000 Stichting CWI, Amsterdam%------------------------------------------------------------------------------if nargin == 4  c = Center;  o=[0 0];  if ~all(size(o) == size(Center))    error(' mupq - unexpected dimensions of Center ')  else    clear o;  endelseif nargin == 3  c = masscenter(F);else  error(' mupq - number of arguments should be either 3 or 4 ')end[hx, hy] = gridfdims(F);val = sum(sum(  xcpowp(F, p, c(1)) ...              .*ycpowp(F, q, c(2)).*F ))*(hx*hy);%------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?