forked from Tianshu-Liu/OpenOpticalFlow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplots_set_1.m
More file actions
114 lines (85 loc) · 1.99 KB
/
plots_set_1.m
File metadata and controls
114 lines (85 loc) · 1.99 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
%% Show the pre-processed images in initial estimation
figure(1);
%clims=[1 250];
%imagesc(uint8(I_region1),clims);
imagesc(uint8(I_region1));
colormap('gray')
axis('image')
title('Downsampled Image 1');
xlabel('x (pixels)');
ylabel('y (pixels)');
figure(2);
%imagesc(uint8(I_region2),clims);
imagesc(uint8(I_region2));
colormap('gray')
axis('image')
title('Downsampled Image 2');
xlabel('x (pixels)');
ylabel('y (pixels)');
% plot initial velocity vector field and streamlines
figure(3);
gx=30; offset=1;
h = vis_flow (ux0, uy0, gx, offset, 3, 'm');
set(h, 'Color', 'red');
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Coarse-Grained Velocity Field');
% plot streamlines
figure(4);
[m,n]=size(ux0);
[x,y]=meshgrid(1:n,1:m);
dn=10;
dm=10;
[sx,sy]=meshgrid(1:dn:n,1:dm:m);
h=streamslice(x, y, ux0, uy0, 4);
set(h, 'Color', 'blue');
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Coarse-Grained Streamlines');
%% Plot the original images
figure(10);
imagesc(Im1);
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
colormap('gray');
title('Image 1');
xlabel('x (pixels)');
ylabel('y (pixels)');
figure(11);
imagesc(Im2);
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
colormap('gray');
title('Image 2');
xlabel('x (pixels)');
ylabel('y (pixels)');
%% Plot refined velocity vector field
figure(12);
gx=50; offset=1;
h = vis_flow (ux, uy, gx, offset, 5, 'm');
set(h, 'Color', 'red');
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Refined Velocity Field');
% plot streamlines
figure(13);
[m,n]=size(ux);
[x,y]=meshgrid(1:n,1:m);
dn=10;
dm=10;
[sx,sy]=meshgrid(1:dn:n,1:dm:m);
h=streamslice(x, y, ux, uy, 4);
set(h, 'Color', 'blue');
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Refined Streamlines');