stencilr2q.m

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

M
38
字号
function [StencilQ, CenterQ] = stencilR2Q(Stencil, Center)%------------------------------------------------------------------------------%% This function transforms a stencil on an ordinary rectangular grid into a % corresponding stencil on a quincunx grid.%% Stencil  = input stencil%% Center   = center of Stencil%% StencilQ = output stencil at quincunx grid%% CenterQ  = center of StencilQ%% See also: stencilUPSaVC%% Design and implementation by:% Dr. Paul M. de Zeeuw <Paul.de.Zeeuw@cwi.nl>  http://homepages.cwi.nl/~pauldz/% Last Revision: November 20, 2000.% Copyright 1999-2002 Stichting CWI, Amsterdam.%------------------------------------------------------------------------------o=[0 0];if ~all(size(o) == size(Center))  error(' stencilR2Q - unexpected dimensions of Center ')else  clear o;end[n, m] = size(Stencil);CenterQ = [(Center(1)-Center(2)+m) (Center(1)+Center(2)-1)];nQ = n+m-1;StencilQ = reshape(linspace(0,0,nQ*nQ),nQ,nQ);for i=1:n   for j=1:m      StencilQ(i-j+m, i+j-1) = Stencil(i, j);   endend%------------------------------------------------------------------------------

⌨️ 快捷键说明

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