⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 laplacian.m

📁 3D shape reconstruction matlab code. It used shape from defocus technique with divergence. You can r
💻 M
字号:
function L = laplacian(A,dir)% Compute the laplacian of A using either the forward% difference scheme or the backward difference scheme%% Copyright 2006 Paolo Favaro (p.favaro@hw.ac.uk)% % School of Engineering and Physical Sciences% Heriot-Watt University, Edinburgh, UK% % Last revision: May 2006%% This program can be used only for research purposes.% This program is distributed WITHOUT ANY WARRANTY; % without even the implied warranty of MERCHANTABILITY % or FITNESS FOR A PARTICULAR PURPOSE.% padding sizewin = 3;if (size(A,3) >  1)       | ...   (size(A,2) == 1)       | ...   (size(A,1) == 1)       | ...   (size(A,1) <  2*win+1) | ...   (size(A,2) <  2*win+1)       error('function:laplacian:wrongInput',...         ['Function laplacian can only handle matrices\n'...          'and they must be at least %ix%i.'],2*win+1,2*win+1);endA = squeeze(A);[M,N] = size(A);% compute the regularization termsx = zeros(M,N);sy = zeros(M,N);sxx = zeros(M,N);syy = zeros(M,N);% alternate the finite difference methodif strcmp(dir,'forward')    sx(:,2:N) = diff(A,1,2);    %sx(:,1) = sx(:,2);    sy(2:M,:) = diff(A,1,1);    %sy(1,:) = sy(2,:);    sxx(:,1:N-1) = diff(sx,1,2);    sxx(:,N) = sxx(:,N-1);    syy(1:M-1,:) = diff(sy,1,1);    syy(M,:) = syy(M-1,:);else    sx(:,1:N-1) = diff(A,1,2);    %sx(:,N) = sx(:,N-1);    sy(1:M-1,:) = diff(A,1,1);    %sy(M,:) = sy(M-1,:);    sxx(:,2:N) = diff(sx,1,2);    sxx(:,1) = sxx(:,2);    syy(2:M,:) = diff(sy,1,1);    syy(1,:) = syy(2,:);endL = sxx+syy;return

⌨️ 快捷键说明

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