Vector field quiver plot for sequence #9
-
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hello @HamidGadirov, and thank you for your interest in scale_factor = 5 # Arbitrary large enough value
for u, v in OF_SEQ:
u /= scale_factor
v /= scale_factor
|
Beta Was this translation helpful? Give feedback.
-
Hi @rfezzani , thanks for the suggestion, I tried to scale the flow vectors when I am visualizing the results and after I compute the norm, e.g. like this:
but it didn't lead to any difference in terms of visualization. All vectors still have the same length and red color no matter which |
Beta Was this translation helpful? Give feedback.
-
After a deeper exploration, it turns out that the solution is simpler then it looks. import numpy as np
import pyimof
from matplotlib import pyplot as plt
plt.ion()
u = np.random.rand(460, 640)
v = np.random.rand(460, 640)
c = np.sqrt(u * u + v * v)
alpha = 1.2
ax = pyimof.display.quiver(u, v, c, clim=(-5, 5))
for _ in range(50):
u *= alpha
v *= alpha
c *= alpha
pyimof.display.quiver(u, v, c, ax=ax, clim=(-5, 5))
input("Press any key") |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Again, the solution is in import numpy as np
import pyimof
from matplotlib import pyplot as plt
plt.ion()
u = np.random.rand(460, 640)
v = np.random.rand(460, 640)
c = np.sqrt(u * u + v * v)
scale = 1
alpha = 1.2
ax = pyimof.display.quiver(u, v, c, clim=(0, 5), scale=scale)
for _ in range(50):
ax.clear()
u *= alpha
v *= alpha
c *= alpha
pyimof.display.quiver(u, v, c, ax=ax, clim=(0, 5), scale=scale)
input("Press any key") I hope it solves your problem. |
Beta Was this translation helpful? Give feedback.
-
Thanks @rfezzani, this is what I was looking for. |
Beta Was this translation helpful? Give feedback.
Again, the solution is in
matplotlib.pyplot.quiver
arguments 😉 : you need to set thescale
argument to a value different thenNone
I hope it solves your problem.