AMLEInpainter

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 classdef AMLEInpainter < FDPDEInpainter
0002     %AMLEINPAINTER Absolutely Minimizing Lipschitz Extension (AMLE) Inpainter
0003     % Implements the method in:
0004     %   Andrés Almansa, Frédéric Cao, Yann Gousseau, and Bernard Rougé.
0005     %   Interpolation of Digital Elevation Models Using AMLE and Related
0006     %   Methods. IEEE TRANSACTIONS ON GEOSCIENCE AND REMOTE SENSING, VOL. 40,
0007     %   NO. 2, FEBRUARY 2002
0008     %
0009     
0010     properties        
0011         Kfx;
0012         Kfy;
0013         Kbx;
0014         Kby;
0015         Kcx;
0016         Kcy;
0017     end
0018     
0019     methods
0020         function obj = AMLEInpainter(varargin)
0021             % Constructor
0022             varargin = obj.removeParentParametersFromVarargin(varargin{:});
0023             
0024             p = inputParser;
0025             parse(p, varargin{:});
0026             
0027             % Compute the stencils
0028             [obj.Kfx, obj.Kfy] = forwardDifferenceKernels(obj.hx, obj.hy);
0029             [obj.Kbx, obj.Kby] = backwardDifferenceKernels(obj.hx, obj.hy);
0030             [obj.Kcx, obj.Kcy] = centeredDifferenceKernels(obj.hx, obj.hy);
0031         end
0032         
0033         function f = stepFun(obj, f, mask)
0034             % First derivatives X/Y
0035             ux = conv2(f, obj.Kfx, 'same');
0036             uy = conv2(f, obj.Kfy, 'same');
0037         
0038             % Second derivatives
0039             uxx = conv2(ux, obj.Kbx, 'same');
0040             uxy = conv2(ux, obj.Kby, 'same');
0041             uyx = conv2(uy, obj.Kbx, 'same');
0042             uyy = conv2(uy, obj.Kby, 'same');
0043     
0044             % Du/|Du| with central differences
0045             v(:, :, 1) = conv2(f, obj.Kcx, 'same');
0046             v(:, :, 2) = conv2(f, obj.Kcy, 'same');
0047             
0048             % Normalize the direction field
0049             dennormal = sqrt(sum(v.^2, 3) + 1e-15);
0050             v(:, :, 1) = v(:, :, 1)./dennormal;
0051             v(:, :, 2) = v(:, :, 2)./dennormal;
0052     
0053             % CORE ITERATION
0054 %             f = -1*(uxx.*v(:, :, 1).^2 + uyy.*v(:, :, 2).^2 + (uxy+uyx).*(v(:,:,1).*v(:,:,2)));
0055             
0056             f = -1*(uxx.*v(:,:,1).^2 + uyy.*v(:,:,2).^2 + (uxy+uyx).*(v(:,:, 1).*v(:,:, 2)));
0057         end        
0058     end
0059 end
0060

Generated on Thu 10-Dec-2020 17:34:27 by m2html © 2005