% Demo script for integrating gradient with control points

% Load Beethoven gradient (script 1_generate_PS_data must have been run)
load results_PS_Beethoven


% Create sparse prior z0 as a matrix of values (NaN if no prior)
z0 = NaN*ones(size(mask));
% Big nose
z0(125,130) = 40;
z0(125,143) = 0;
z0(125,115) = 0;
% Flat left eye
z0(95:115,95:125) = 0;

% Weight lambda between depth prior and normals : 0 when no prior, >> 0 if prior available
lambda = 1e3; % Or any "high" value

z2 = integrate_with_prior(p,q,z0,lambda,mask);


% Show result
figure(6)
surfl(fliplr(z2),[0 90])
shading flat
axis equal
view(130,30)
colormap gray
camlight headlight
camlight(0,90)
axis off
title('Integration with control points','Interpreter','Latex','Fontsize',18)
