-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathplot_sequence.m
More file actions
86 lines (65 loc) · 1.85 KB
/
Copy pathplot_sequence.m
File metadata and controls
86 lines (65 loc) · 1.85 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
%%
clc;clear;close all;
addpath([pwd(),'/../matlab/']);
outdir = [pwd(),'/output_W07/'];
framesdir = [pwd(),'/frames/'];
mkdir( framesdir );
%%
for iidx = 0:100
workdir = sprintf('%s/%06d_wd', outdir, iidx );
workdirzip = [workdir,'.zip'];
was_unzipped = 0;
if exist(workdir','dir') ~= 7
if exist(workdirzip','file')==2
prev = cd(outdir);
unzip(workdirzip);
cd(prev);
was_unzipped = 1;
else
fprintf( '%s does not exist, exiting\n', workdir);
break;
end
end
fprintf( '%s\n',workdir);
prev = cd(workdir);
mesh = load_camera_mesh();
plane = importdata('plane.txt');
P1 = importdata('P1cam.txt');
img = imread('undistorted/00000001.png');
cd(prev);
%%
Npts = size(mesh,2);
elevations = dot( [mesh;ones(1,size(mesh,2))], repmat(plane,1,Npts) );
% fix scale and z direction
elevations = -elevations * 2.50;
%%
% project
pt2d = P1 * [mesh;ones(1,size(mesh,2))];
pt2d = pt2d ./ repmat( pt2d(3,:),3,1);
%%
close all;
iptsetpref('ImshowBorder','loose');
imgrgb = repmat(img,[1,1,3]);
hhfig = figure;
imshow(imgrgb);
hold on;
hs = scatter( pt2d(1,:), pt2d(2,:),1,elevations,'.');
hs.MarkerEdgeAlpha=0.05;
caxis( [-1.3 1.3] );
title(sprintf('Frame %06d - %07d points http://www.dais.unive.it/wass', iidx, Npts) );
c = colorbar;
ylabel(c,'Elevation (m)');
axis ij;
colormap jet;
crop = 20;
hhfig.Position = [0 0 1440+crop*2 1080+crop*2];
drawnow;
ii = getframe(hhfig);
ii = ii.cdata;
ii = ii( crop-10:(end-crop-10), crop+5:(end-crop-5), : );
close all;
imwrite(ii,sprintf('%s/frm%06d.png',framesdir,iidx));
if was_unzipped
rmdir( workdir, 's' );
end
end