# Wavelet Transform on 3D Meshes¶


This tour explores multiscale computation on 3D meshes using the lifting wavelet transform.

In [2]:
addpath('toolbox_signal')


## Functions Defined on Surfaces¶

One can define a function on a discrete 3D mesh that assigns a value to each vertex. One can then perform processing of the function according to the geometry of the surface. Here we use a simple sphere.

First compute a multiresolution sphere.

In [3]:
options.base_mesh = 'ico';
options.relaxation = 1;
options.keep_subdivision = 1;
J = 6;
[vertex,face] = compute_semiregular_sphere(J,options);


Options for the display.

In [4]:
options.use_color = 1;
options.rho = .3;
options.color = 'rescale';
options.use_elevation = 0;


Then define a function on the sphere. Here the function is loaded from an image of the earth.

In [5]:
f = load_spherical_function('earth', vertex{end}, options);


Display the function.

In [6]:
clf;
plot_spherical_function(vertex,face,f, options);
colormap gray(256);


## Wavelet Transform of Functions Defined on Surfaces¶

A wavelet transform can be used to compress a function defined on a surface. Here we take the example of a 3D sphere. The wavelet transform is implemented with the Lifting Scheme of Sweldens, extended to triangulated meshes by Sweldens and Schroder in a SIGGRAPH 1995 paper.

Perform the wavelet transform.

In [7]:
fw = perform_wavelet_mesh_transform(vertex,face, f, +1, options);


Threshold (remove) most of the coefficient.

In [8]:
r = .1;
fwT = perform_thresholding( fw, round(r*length(fw)), 'largest' );


Backward transform.

In [9]:
f1 = perform_wavelet_mesh_transform(vertex,face, fwT, -1, options);


Display it.

In [10]:
clf;
subplot(1,2,1);
plot_spherical_function(vertex,face,f, options);
title('Original function');
subplot(1,2,2);
plot_spherical_function(vertex,face,f1, options);
title('Approximated function');
colormap gray(256);


Exercise 1

Plot the approximation curve error as a function of the number of coefficient.

In [11]:
exo1()

In [12]:
%% Insert your code here.


Exercise 2

Perform denoising of spherical function by thresholding. Study the evolution of the optimal threshold as a function of the noise level.

In [13]:
exo2()

In [14]:
%% Insert your code here.


Exercise 3

Display a dual wavelet that is used for the reconstruction by taking the inverse transform of a dirac.

In [15]:
exo3()

In [16]:
%% Insert your code here.


## Spherical Geometry Images¶

A simple way to store a mesh is using a geometry images. This will be usefull to create a semi-regular mesh.

Firs we load a geometry image, which is a |(n,n,3)| array |M| where each |M(:,:,i)| encode a X,Y or Z component of the surface. The concept of geometry images was introduced by Hoppe and collaborators.

In [17]:
name = 'bunny';
n = size(M,1);


A geometry image can be displayed as a color image.

In [18]:
clf;
imageplot(M);


But it can be displayed as a surface. The red curves are the seams in the surface to map it onto a sphere.

In [19]:
clf;
plot_geometry_image(M, 1,1);
view(20,88);