-
Notifications
You must be signed in to change notification settings - Fork 23
/
example1.m
34 lines (26 loc) · 1023 Bytes
/
example1.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% Example 1: Synthesis of a "text" texture image, using
% Portilla-Simoncelli texture analysis/synthesis code, based on
% alternate projections onto statistical constraints in a complex
% overcomplete wavelet representation.
%
% See Readme.txt, and headers of textureAnalysis.m and
% textureSynthesis.m for more details.
%
% Javier Portilla ([email protected]). March, 2001
close all
im0 = pgmRead('text.pgm'); % im0 is a double float matrix!
Nsc = 4; % Number of scales
Nor = 4; % Number of orientations
Na = 9; % Spatial neighborhood is Na x Na coefficients
% It must be an odd number!
params = textureAnalysis(im0, Nsc, Nor, Na);
Niter = 25; % Number of iterations of synthesis loop
Nsx = 192; % Size of synthetic image is Nsy x Nsx
Nsy = 128; % WARNING: Both dimensions must be multiple of 2^(Nsc+2)
res = textureSynthesis(params, [Nsy Nsx], Niter);
close all
figure(1)
showIm(im0, 'auto', 1, 'Original texture');
figure(2)
showIm(res, 'auto', 1, 'Synthesized texture');
% Can you read the NEW text? ;-)