pyramid.m

来自「来自澳大利亚Qeensland大学的计算机视觉Matlab工具箱。 This 」· M 代码 · 共 46 行

M
46
字号
%PYRAMID	Pyramidal image decomposition%%	p = pyramid(im)%	p = pyramid(im, sigma)%	p = pyramid(im, sigma, N)%%	Compute pyramid decomposition of input image, IM, using Gaussian%	smoothing of SIGMA (default 1) prior to each decimation.  If N %	is specified compute only that number of steps.%% SEE ALSO:	igauss%%	Copyright (c) Peter Corke, 1999  Machine Vision Toolbox for Matlab% 1995 Peter Corkefunction p = pyramid(im, sigma, N)	if nargin < 2,		sigma = 1;	elseif nargin < 3,		N = floor(log2(min(size(im))));	end	N	[height,width] = size(im);	% figure the width of the pyramids (sum of a power series)	w = width * (1 - (1/2)^(N-1));	p = zeros(height/2, w);		% make a blank image	mask = igauss(2, sigma);	w = 0;	for k = 1:N,		[nrows,ncols] = size(im);		% smooth		im = conv2(im, mask, 'same');		% sub sample		im = im(1:2:nrows,1:2:ncols);		% place it		p(1:numrows(im),w+1:w+numcols(im)) = im;		w = w + numcols(im);		w	end

⌨️ 快捷键说明

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