% Course n?1 for "A Matlab Tour of Fast Marching Methods"
% first set up path
path(path, 'toolbox_fast_marching/');
path(path, 'toolbox_fast_marching/data/');
path(path, 'toolbox_fast_marching/toolbox/');
rep = 'images/raw/';
if ~exist(rep)
mkdir(rep);
end
test_2d = 0;
test_3d = 0;
test_sampling = 0;
test_heuristic = 0;
test_voronoi = 0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2D shortest paths
if test_2d
n = 200;
name = 'road2';
name = 'mountain';
name = 'cavern';
W = imread([name '.png']);
W = rescale( double(W) );
W = W + 0.01;
[start_points,end_points] = pick_start_end_point(W);
% options.nb_iter_max = Inf;
% options.Tmax = sum(size(W));
options.end_points = end_points;
disp('Performing front propagation.');
[D,S] = perform_fast_marching_2d(W, start_points, options);
disp('Extracting path.');
p = extract_path_2d(D,end_points, options);
clf;
D1 = D; I = find(isinf(D)); J = find(~isinf(D));
D1(I) = max(D(J));
imagesc(D1'); axis image; axis off;
axis xy;
colormap jet(256);
saveas(gcf, [rep name '-dist-function.jpg'], 'jpg');
clf;
plot_fast_marching_2d(W,S,p,start_points,end_points);
colormap jet(256);
saveas(gcf, [rep name '-shortest-path-2d.jpg'], 'jpg');
clf;
contour(D1',50); axis image; axis off; axis xy;
colormap jet(256);
saveas(gcf, [rep name '-dist-function-contour.jpg'], 'jpg');
% essayer avec d'autres images : 'road2.png' 'moutain.png'
% essayer avec d'autres type d'?nergies (gradient filtr?s).
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Voronoi cels
if test_voronoi
n = 300;
name = 'constant';
name = 'mountain';
[M,W] = load_potential_map(name, n);
if strcmp(name, 'mountain')
W = rescale(W,0.05,1);
end
m = 50; % number of center points
if ~exist('start_points') || size(start_points,2)~=m
start_points = floor( rand(2,m)*(n-1) ) +1;
start_points = unique(start_points', 'rows')';
end
disp('Performing front propagation.');
[D,Z,Q] = perform_fast_marching_2d(W, start_points);
clf;
hold on;
imagesc(D'); axis image; axis off;
plot(start_points(1,:), start_points(2,:), '.');
hold off;
axis xy;
colormap gray(256);
saveas(gcf, [rep name '-voronoi-dist.jpg'], 'jpg');
faces = compute_voronoi_triangulation(Q);
hold on;
sel = randperm(max(Q(:)));
imagesc(sel(Q)'); axis image; axis off;
plot(start_points(1,:), start_points(2,:), 'b.', 'MarkerSize', 20);
plot_edges(compute_edges(faces), start_points, 'k');
hold off;
axis tight; axis image; axis off;
colormap jet(256);
saveas(gcf, [rep name '-voronoi-triangulation.jpg'], 'jpg');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3D shortest paths
if test_3d
n = 60;
% gaussian weight (path will avoid center of the cube)
x = -1:2/(n-1):1;
[X,Y,Z] = meshgrid(x,x,x);
sigma = 0.3;
W = 1./(1 + exp( -(X.^2+Y.^2+Z.^2)/sigma^2 ) );
k = 18;
start_points = [n-k;k;k];
end_points = [k;n-k;n-k];
options.nb_iter_max = Inf;
options.end_points = end_points;
[D,S] = perform_fast_marching_3d(W, start_points, options);
p = extract_path_3d(D,end_points);
% draw the path
plot_fast_marching_3d(D,S,p,start_points,end_points);
saveas(gcf, [rep 'shortest-path-3d.jpg'], 'jpg');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% farthest point sampling
if test_sampling
% test for farthest point sampling
n = 300;
name = 'bump';
name = 'gaussian';
name = 'road2';
name = 'mountain';
[M,W] = load_potential_map(name, n);
% plot sampling location
i = 0;
for nbr_landmarks = 50:50:300
i = i+1;
disp('Perform farthest point sampling');
landmark = farthest_point_sampling( W, [], nbr_landmarks );
clf;
hold on;
imagesc(M');
plot(landmark(1,:), landmark(2,:), 'b.', 'MarkerSize', 20);
hold off;
axis tight; axis image; axis off;
colormap gray(256);
saveas(gcf, [rep 'farthest-sampling-' num2str(nbr_landmarks) '.jpg'], 'jpg');
[D,Z,Q] = perform_fast_marching_2d(W, landmark);
faces = compute_voronoi_triangulation(Q);
hold on;
imagesc(M'); axis image; axis off;
plot(landmark(1,:), landmark(2,:), 'b.', 'MarkerSize', 20);
plot_edges(compute_edges(faces), landmark, 'k');
hold off;
axis tight; axis image; axis off;
colormap gray(256);
saveas(gcf, [rep name '-sampling-triangulation-' num2str(nbr_landmarks) '.jpg'], 'jpg');
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% heuristic computation
if test_heuristic
n = 200;
name = 'cavern';
name = 'mountain';
name = 'road2';
weight = 0.9;
W = imread([name '.png']);
W = rescale( double(W) );
W = W + 0.01;
% [start_points,end_points] = pick_start_end_point(W);
% compute heuristic
[H,S] = perform_fast_marching_2d(W, end_points);
% options.nb_iter_max = Inf;
options.end_points = end_points;
disp('Performing front propagation.');
[D,S] = perform_fast_marching_2d(W, start_points, options, H*weight);
disp('Extracting path.');
p = extract_path_2d(D,end_points, options);
clf;
plot_fast_marching_2d(W,S,p,start_points,end_points);
colormap jet(256);
saveas(gcf, [rep name '-heuristic' num2str(weight) '.jpg'], 'jpg');
end
没有合适的资源?快使用搜索试试~ 我知道了~
流形学习(LLE)源代码(matlab编写)
共252个文件
jpg:182个
png:43个
html:8个
5星 · 超过95%的资源 需积分: 23 207 下载量 53 浏览量
2010-03-08
18:20:24
上传
评论 8
收藏 10.5MB ZIP 举报
温馨提示
流形学习的源代码,matlab编写,方法请见2000年science的文献
资源推荐
资源详情
资源评论
收起资源包目录
流形学习(LLE)源代码(matlab编写) (252个子文件)
styles.css 2KB
.DS_Store 15KB
.DS_Store 15KB
.DS_Store 12KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
tp2.html 20KB
tp4.html 19KB
tp3.html 13KB
tp1.html 11KB
tp5.html 10KB
index.html 4KB
tp0.html 4KB
references.html 3KB
logo-manifold-small.jpg 130KB
disks-pca.jpg 23KB
swissroll-graph.jpg 22KB
disks-isomap.jpg 22KB
frey_rawface-dataset.jpg 21KB
disks-dataset.jpg 20KB
frey_rawface-pca.jpg 20KB
frey_rawface-isomap.jpg 18KB
bunny-cst-sampl-1400.jpg 18KB
nefertiti-param-sconf.jpg 18KB
nefertiti-param-scomb.jpg 17KB
bunny-grad-sampl-1400.jpg 17KB
bunny-cst-sampl-800.jpg 17KB
bunny-split-sampl-1400.jpg 17KB
bunny-grad-sampl-800.jpg 16KB
bunny-cst-sampl-500.jpg 16KB
bunny-split-sampl-800.jpg 16KB
bunny-split-sampl-500.jpg 16KB
bunny-cst-sampl-300.jpg 15KB
swissroll-dist.jpg 15KB
scurve-dred-pca.jpg 15KB
mountain-sampling-tr-300.jpg 15KB
bunny-grad-sampl-500.jpg 15KB
nefertiti-param-cconf.jpg 15KB
nefertiti-flat-isomap.jpg 15KB
nefertiti-param-ccomb.jpg 15KB
mountain-voronoi-tr.jpg 15KB
constant-voronoi-tr.jpg 15KB
mountain-sampling-tr-250.jpg 14KB
bunny-split-sampl-300.jpg 14KB
bunny-grad-sampl-300.jpg 14KB
scurve-graph.jpg 14KB
nefertiti-flat-confo.jpg 14KB
road2-heuristic0.9.jpg 14KB
road2-heuristic0.5.jpg 14KB
mountain-sampling-tr-200.jpg 14KB
hand-50kv-cst-sampl-1500.jpg 14KB
nefertiti-flat-combi.jpg 13KB
bunny-cst-sampl-100.jpg 13KB
hand-50kv-cst-sampl-800.jpg 13KB
swissroll-display.jpg 13KB
mountain-sampling-300.jpg 13KB
hand-50kv-cst-sampl-500.jpg 13KB
mountain-sampling-tr-150.jpg 13KB
cavern-dist-function-contour.jpg 12KB
road2-shortest-path-2d.jpg 12KB
road2-dist-function-contour.jpg 12KB
hand-50kv-cst-sampl-300.jpg 12KB
scurve-dist.jpg 12KB
skull-segm-50.jpg 12KB
skull-dist-50.jpg 12KB
mountain-sampling-250.jpg 12KB
skull-segm-30.jpg 12KB
bunny-grad-remesh-1400.jpg 11KB
road2-heuristic0.jpg 11KB
nefertiti-param-tconf.jpg 11KB
nefertiti-param-tcomb.jpg 11KB
scurve-dred-isomap.jpg 11KB
elephant-prop-5.jpg 11KB
skull-dist-30.jpg 11KB
cavern-shortest-path-2d.jpg 11KB
bunny-cst-remesh-1400.jpg 11KB
skull-segm-16.jpg 11KB
mountain-sampling-tr-100.jpg 11KB
skull-segm-8.jpg 11KB
elephant-prop-4.jpg 11KB
bunny-grad-remesh-800.jpg 11KB
mountain-sampling-200.jpg 11KB
bunny-split-remesh-1400.jpg 11KB
bunny-cst-remesh-800.jpg 11KB
skull-dist-16.jpg 11KB
elephant-prop-3.jpg 11KB
bunny-grad-remesh-500.jpg 11KB
skull-dist-8.jpg 10KB
skull-segm-6.jpg 10KB
mountain-dist-func-cont.jpg 10KB
skull-dist-6.jpg 10KB
bunny-split-remesh-800.jpg 10KB
bunny-grad-remesh-300.jpg 10KB
skull-dist-4.jpg 10KB
bunny-cst-remesh-500.jpg 10KB
elephant-prop-2.jpg 10KB
skull-dist-3.jpg 10KB
共 252 条
- 1
- 2
- 3
caoweiguo
- 粉丝: 0
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页