Skip to content

Commit

Permalink
Added files for natural image and 3-circle model examples in the tuto…
Browse files Browse the repository at this point in the history
…rial.
  • Loading branch information
henryadams committed Mar 13, 2015
1 parent deab1dd commit b3199ca
Show file tree
Hide file tree
Showing 10 changed files with 1,860 additions and 0 deletions.
Binary file added reports/javaplex_tutorial/lazyOpticalDct-k15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added reports/javaplex_tutorial/lazyOpticalDct-k300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added reports/javaplex_tutorial/nk15c30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added reports/javaplex_tutorial/nk300c30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,737 changes: 1,737 additions & 0 deletions reports/javaplex_tutorial/threeCircle.eps

Large diffs are not rendered by default.

Binary file added reports/javaplex_tutorial/threeCircle.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
% This shows the optical image patch example - Section 6

clc; clear; close all;

% k = 300
load pointsOpticalDct_k300.mat
size(pointsOpticalDct_k300)

max_dimension = 3;
num_landmark_points = 50;
nu = 1;
num_divisions = 500;

% create a sequential maxmin landmark selector
landmark_selector = api.Plex4.createMaxMinSelector(pointsOpticalDct_k300, num_landmark_points);
R = landmark_selector.getMaxDistanceFromPointsToLandmarks()
max_filtration_value = R / 4;

% create a lazy witness stream
stream = streams.impl.LazyWitnessStream(landmark_selector.getUnderlyingMetricSpace(), landmark_selector, max_dimension, max_filtration_value, nu, num_divisions);
stream.finalizeStream()

% print out the size of the stream
num_simplices = stream.getSize()

% get persistence algorithm over Z/2Z
persistence = api.Plex4.getModularSimplicialAlgorithm(max_dimension, 2);

% compute the intervals
intervals = persistence.computeIntervals(stream);

% create the barcode plots
options.filename = 'lazyOpticalDct-k300';
options.max_filtration_value = max_filtration_value;
options.max_dimension = max_dimension - 1;
plot_barcodes(intervals, options);

% plot a projection of the dataset onto the first two DCT basis vectors
figure
scatter(pointsOpticalDct_k300(:,1), pointsOpticalDct_k300(:,2), '.')
axis square

% k = 15
load pointsOpticalDct_k15.mat
size(pointsOpticalDct_k15)

max_dimension = 3;
num_landmark_points = 50;
nu = 1;
num_divisions = 500;

% create a sequential maxmin landmark selector
landmark_selector = api.Plex4.createMaxMinSelector(pointsOpticalDct_k15, num_landmark_points);
R = landmark_selector.getMaxDistanceFromPointsToLandmarks()
max_filtration_value = R / 4;

% create a lazy witness stream
stream = streams.impl.LazyWitnessStream(landmark_selector.getUnderlyingMetricSpace(), landmark_selector, max_dimension, max_filtration_value, nu, num_divisions);
stream.finalizeStream()

% print out the size of the stream
num_simplices = stream.getSize()

% get persistence algorithm over Z/2Z
persistence = api.Plex4.getModularSimplicialAlgorithm(max_dimension, 2);

% compute the intervals
intervals = persistence.computeIntervals(stream);

% create the barcode plots
options.filename = 'lazyOpticalDct-k15';
options.max_filtration_value = max_filtration_value;
options.max_dimension = max_dimension - 1;
plot_barcodes(intervals, options);

% plot a projection of the dataset onto the first two DCT basis vectors
figure
scatter(pointsOpticalDct_k15(:,1), pointsOpticalDct_k15(:,2), '.')
axis square
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
% This shows the range image patch example - Section 6

clc; clear; close all;

load pointsRange.mat
size(pointsRange)

max_dimension = 3;
num_landmark_points = 50;
nu = 1;
num_divisions = 500;

% create a sequential maxmin landmark selector
landmark_selector = api.Plex4.createMaxMinSelector(pointsRange, num_landmark_points);
R = landmark_selector.getMaxDistanceFromPointsToLandmarks()
max_filtration_value = R / 3;

% create a lazy witness stream
stream = streams.impl.LazyWitnessStream(landmark_selector.getUnderlyingMetricSpace(), landmark_selector, max_dimension, max_filtration_value, nu, num_divisions);
stream.finalizeStream()

% print out the size of the stream - will be quite large since the complex
% construction is very sensitive to the maximum filtration value
num_simplices = stream.getSize()

% get persistence algorithm over Z/2Z
persistence = api.Plex4.getModularSimplicialAlgorithm(max_dimension, 2);

% compute the intervals
intervals = persistence.computeIntervals(stream);

% create the barcode plots
options.filename = 'lazyRange';
options.max_filtration_value = max_filtration_value;
options.max_dimension = max_dimension - 1;
plot_barcodes(intervals, options);

%% DCT

pointsRangeDct = pointsRange * dct(5);

figure;
scatter(pointsRangeDct(:,1), pointsRangeDct(:,5), '.')
axis square

0 comments on commit b3199ca

Please sign in to comment.