-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added files for natural image and 3-circle model examples in the tuto…
…rial.
- Loading branch information
1 parent
deab1dd
commit b3199ca
Showing
10 changed files
with
1,860 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
79 changes: 79 additions & 0 deletions
79
src/matlab/for_distribution/tutorial_examples/optical_image_example.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+898 KB
src/matlab/for_distribution/tutorial_examples/pointsOpticalDct_k15.mat
Binary file not shown.
Binary file added
BIN
+898 KB
src/matlab/for_distribution/tutorial_examples/pointsOpticalDct_k300.mat
Binary file not shown.
44 changes: 44 additions & 0 deletions
44
src/matlab/for_distribution/tutorial_examples/range_image_example.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |