📄 pyramid.m
字号:
%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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -