forked from Tianshu-Liu/OpenOpticalFlow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplots_set_2.asv
More file actions
132 lines (104 loc) · 2.18 KB
/
plots_set_2.asv
File metadata and controls
132 lines (104 loc) · 2.18 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
% calculate the velocity magnitude
u_mag=(ux.^2+uy.^2).^0.5;
u_max=max(max(u_mag));
u_mag=u_mag/u_max;
% calculate vorticity
vor=vorticity(ux, uy);
vor_max=max(max(abs(vor)));
vor=vor/vor_max;
% calculate the 2nd invariant
Q=invariant2_factor(ux, uy, 1, 1);
% plot velocity magnitude field
figure(20);
ulims=[0, 1];
imagesc(u_mag,ulims);
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Velocity Magnitude Field');
colorbar;
hold on;
% plot streamlines
figure(20);
[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', 'yellow');
hold off;
% plot Vorticity field
figure(21);
vlims=[-1, 1];
imagesc(vor,vlims);
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Vorticity Field');
colorbar;
hold on;
% plot streamlines
figure(21);
[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');
hold off;
% plot Vorticity field
figure(22);
vlims=[-1, 1];
imagesc(vor,vlims);
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Vorticity Field');
colorbar;
hold on;
% Plot refined velocity vector field
figure(22);
gx=50; offset=1;
h = vis_flow (ux, uy, gx, offset, 3, 'm');
set(h, 'Color', 'black');
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
hold off;
% plot Vorticity field
figure(23);
vlims=[-1, 1];
imagesc(u_ma,vlims);
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Vorticity Field');
colorbar;
hold on;
% Plot refined velocity vector field
figure(22);
gx=50; offset=1;
h = vis_flow (ux, uy, gx, offset, 3, 'm');
set(h, 'Color', 'black');
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
hold off;
% plot Q field
figure(24);
Qlims=[0, 0.1];
imagesc(Q,Qlims);
xlabel('x (pixels)');
ylabel('y (pixels)');
axis image;
set(gca,'YDir','reverse');
title('Q Field');
colorbar;