Important: Please read the installation page for details about how to install the toolboxes. $\newcommand{\dotp}[2]{\langle #1, #2 \rangle}$ $\newcommand{\enscond}[2]{\lbrace #1, #2 \rbrace}$ $\newcommand{\pd}[2]{ \frac{ \partial #1}{\partial #2} }$ $\newcommand{\umin}[1]{\underset{#1}{\min}\;}$ $\newcommand{\umax}[1]{\underset{#1}{\max}\;}$ $\newcommand{\umin}[1]{\underset{#1}{\min}\;}$ $\newcommand{\uargmin}[1]{\underset{#1}{argmin}\;}$ $\newcommand{\norm}[1]{\|#1\|}$ $\newcommand{\abs}[1]{\left|#1\right|}$ $\newcommand{\choice}[1]{ \left\{ \begin{array}{l} #1 \end{array} \right. }$ $\newcommand{\pa}[1]{\left(#1\right)}$ $\newcommand{\diag}[1]{{diag}\left( #1 \right)}$ $\newcommand{\qandq}{\quad\text{and}\quad}$ $\newcommand{\qwhereq}{\quad\text{where}\quad}$ $\newcommand{\qifq}{ \quad \text{if} \quad }$ $\newcommand{\qarrq}{ \quad \Longrightarrow \quad }$ $\newcommand{\ZZ}{\mathbb{Z}}$ $\newcommand{\CC}{\mathbb{C}}$ $\newcommand{\RR}{\mathbb{R}}$ $\newcommand{\EE}{\mathbb{E}}$ $\newcommand{\Zz}{\mathcal{Z}}$ $\newcommand{\Ww}{\mathcal{W}}$ $\newcommand{\Vv}{\mathcal{V}}$ $\newcommand{\Nn}{\mathcal{N}}$ $\newcommand{\NN}{\mathcal{N}}$ $\newcommand{\Hh}{\mathcal{H}}$ $\newcommand{\Bb}{\mathcal{B}}$ $\newcommand{\Ee}{\mathcal{E}}$ $\newcommand{\Cc}{\mathcal{C}}$ $\newcommand{\Gg}{\mathcal{G}}$ $\newcommand{\Ss}{\mathcal{S}}$ $\newcommand{\Pp}{\mathcal{P}}$ $\newcommand{\Ff}{\mathcal{F}}$ $\newcommand{\Xx}{\mathcal{X}}$ $\newcommand{\Mm}{\mathcal{M}}$ $\newcommand{\Ii}{\mathcal{I}}$ $\newcommand{\Dd}{\mathcal{D}}$ $\newcommand{\Ll}{\mathcal{L}}$ $\newcommand{\Tt}{\mathcal{T}}$ $\newcommand{\si}{\sigma}$ $\newcommand{\al}{\alpha}$ $\newcommand{\la}{\lambda}$ $\newcommand{\ga}{\gamma}$ $\newcommand{\Ga}{\Gamma}$ $\newcommand{\La}{\Lambda}$ $\newcommand{\si}{\sigma}$ $\newcommand{\Si}{\Sigma}$ $\newcommand{\be}{\beta}$ $\newcommand{\de}{\delta}$ $\newcommand{\De}{\Delta}$ $\newcommand{\phi}{\varphi}$ $\newcommand{\th}{\theta}$ $\newcommand{\om}{\omega}$ $\newcommand{\Om}{\Omega}$
This numerical tour explores image synthesis using diffusion equation. You might first have a look at the numerical tours on Heat diffusion and Total variation minimization that introduces these two notions.
addpath('toolbox_signal')
addpath('toolbox_general')
addpath('solutions/graphics_3_synthesis_diffusion')
It is possible to synthesis a cloudy image by a simple smoothing of a noise. Histogram equalization helps to maintain the contrast.
n = 256;
We blur a noisy image to have a cloud texture.
M1 = perform_blurring(randn(n,n), 15);
We impose a flat histogram to enhance the contrast.
x = linspace(0,1, n*n);
M2 = perform_hist_eq(M1,x);
display
clf;
imageplot(M1, 'Original', 1,2,1);
imageplot(M2, 'Equalized', 1,2,2);
Exercise 1
Perform a synthesis by running a heat diffusion, starting with a random noise a time |T=0|. At each step of the diffusion, perform an histogram equation to keep the contrast of the texture. tep size umber of iteration
exo1()
%% Insert your code here.
The total variation minimization reduce the number of edges and is usually used as a denoising method. It can also be used to perform synthesis of singular images.
The total variation roughly measures the number of edges present in an image.
M = rescale( load_image('lena', n) );
Gr = grad(M);
tv = sum(sum( sqrt(sum(Gr.^2,3)), 2 ), 1);
disp(strcat(['Total variation of M = ' num2str(tv) '.']));
Total variation of M = 3988.3181.
Exercise 2
Starting from an initial noise image, perform a total variation minimization. At each step of the descent, perform an histogram equalization so that the texture has a flat histogram. tep size void instabilities umber of iteration
exo2()
%% Insert your code here.
Exercise 3
Perfrom a synthesis that mixes both TV minimization (to reduce the TV norm) and wavelet histogram equalization (to control the distribution of singularities). Stop the iterations when the synthesized image has the same TV norm as the original one.
exo3()
%% Insert your code here.